Sign in

    uv

    MoonBit binding to libuv

    Download zip
    Version
    0.4.0
    License
    Apache-2.0
    Last updated
    last year
    Downloads
    1K

    #tonyfettes/uv

    This is a MoonBit binding to the libuv library.

    #Quickstart

    1. Add this module as a dependency to your MoonBit project.

      moon update moon add tonyfettes/uv

    2. Import tonyfettes/uv package where you need it.

      { "import": [ "tonyfettes/uv" ] }

    3. Use the tonyfettes/uv package in your MoonBit project.

      fn main {
      try {
      let uv = @uv.Loop::new!()
      let options = @uv.ProcessOptions::new(
      "mkdir",
      ["mkdir", "test-dir"],
      fn(process, exit_status, term_signal) {
      println(
      "Process exited with status \{exit_status} and signal \{term_signal}",
      )
      process.close(fn(_) { })
      },
      )
      let process = uv.spawn!(options)
      println("Launched process with ID \{(process).pid()}")
      uv.run!(Default)
      uv.stop()
      uv.close!()
      } catch {
      error => println("Error: \{error}")
      }
      }

    Copy

    pub trait Copy {
    copy(Self) -> Self
    }

    ToHandle

    pub trait ToHandle {
    to_handle(Self) -> Handle
    of_handle(Handle) -> Self
    close(Self, (Self) -> Unit) -> Unit
    is_closing(Self) -> Bool
    }

    ToNtbs

    pub(open) trait ToNtbs {
    to_ntbs(Self) -> Bytes
    }

    impl ToNtbs for String
    impl ToNtbs for Bytes
    impl ToNtbs for View

    ToReq

    pub trait ToReq {
    to_req(Self) -> Req
    }

    ToSockaddr

    trait ToSockaddr

    ToStream

    pub trait ToStream : ToHandle {
    to_stream(Self) -> Stream
    of_stream(Stream) -> Self
    read_start(Self, (Self, Int) ->
    View
    , (Self, Int,
    View
    ) -> Unit, (Self, Errno) -> Unit) -> Unit!Errno
    read_stop(Self) -> Unit!Errno
    write(Self, Array[
    View
    ], (Write) -> Unit, (Write, Errno) -> Unit) -> Unit!Errno
    listen(Self, Int, (Self) -> Unit, (Self, Errno) -> Unit) -> Unit!Errno
    is_readable(Self) -> Bool
    is_writable(Self) -> Bool
    shutdown(Self, (Shutdown) -> Unit, (Shutdown, Errno) -> Unit) -> Unit!Errno
    }

    AddrInfo

    type AddrInfo

    AddrInfo::addr

    fn AddrInfo::addr(self : AddrInfo) -> Sockaddr

    AddrInfo::canonname

    fn AddrInfo::canonname(self : AddrInfo) -> String?

    AddrInfo::family

    fn AddrInfo::family(self : AddrInfo) -> AddressFamily!Errno

    AddrInfo::protocol

    fn AddrInfo::protocol(self : AddrInfo) -> Protocol!Errno

    AddrInfo::socktype

    fn AddrInfo::socktype(self : AddrInfo) -> SockType!Errno

    AddrInfoFlags

    type AddrInfoFlags

    AddrInfoFlags::new

    fn AddrInfoFlags::new(passive~ : Bool = .., canonname~ : Bool = .., numeric_host~ : Bool = .., numeric_serv~ : Bool = .., all~ : Bool = .., addrconfig~ : Bool = .., v4mapped~ : Bool = ..) -> AddrInfoFlags

    AddrInfoHints

    type AddrInfoHints

    AddrInfoHints::new

    fn AddrInfoHints::new(flags? : AddrInfoFlags, family? : AddressFamily, socktype? : SockType, protocol? : Protocol) -> AddrInfoHints

    AddressFamily

    pub enum AddressFamily {
    INET
    INET6
    }

    AddressFamily::inet

    AddressFamily::inet6

    Connect

    type Connect

    impl ToReq for Connect

    CopyFileFlags

    type CopyFileFlags

    CopyFileFlags::new

    fn CopyFileFlags::new(allow_exists~ : Bool = .., copy_on_write~ : CopyOnWrite = ..) -> CopyFileFlags

    CopyOnWrite

    pub(all) enum CopyOnWrite {
    False
    True
    Force
    }

    Dirent

    type Dirent

    Dirent::name

    fn Dirent::name(self : Dirent) -> String

    Dirent::type_

    fn Dirent::type_(self : Dirent) -> DirentType

    DirentType

    pub enum DirentType {
    Unknown
    File
    Dir
    Link
    Fifo
    Socket
    Char
    Block
    }

    impl Show for DirentType

    Errno

    pub type! Errno Status

    impl Eq for Errno
    impl Hash for Errno
    impl Show for Errno

    File

    type File

    type Fs

    impl ToReq for Fs

    FsEvent

    type FsEvent

    impl ToHandle for FsEvent

    FsEvent::get_path

    fn FsEvent::get_path(self : FsEvent) -> String!Errno

    FsEvent::new

    fn FsEvent::new(self : Loop) -> FsEvent!Errno

    FsEvent::start

    fn FsEvent::start(self : FsEvent, path : String, flags : FsEventFlags, event_cb : (FsEvent, String?, Array[FsEventType]) -> Unit, error_cb : (FsEvent, String?, Errno) -> Unit) -> Unit!Errno

    FsEvent::stop

    fn FsEvent::stop(self : FsEvent) -> Unit!Errno

    FsEventFlags

    type FsEventFlags

    FsEventFlags::new

    fn FsEventFlags::new(recursive~ : Bool = ..) -> FsEventFlags

    FsEventType

    pub enum FsEventType {
    Rename
    Change
    }

    impl Show for FsEventType

    GetAddrInfo

    type GetAddrInfo

    Gid

    type Gid

    Handle

    type Handle

    Handle::close

    fn Handle::close(self : Handle, cb : (Handle) -> Unit) -> Unit

    Handle::is_closing

    fn Handle::is_closing(self : Handle) -> Bool

    Idle

    type Idle

    impl ToHandle for Idle

    Idle::new

    fn Idle::new(self : Loop) -> Idle!Errno

    Idle::start

    fn Idle::start(self : Idle, cb : (Idle) -> Unit) -> Unit!Errno

    Idle::stop

    fn Idle::stop(self : Idle) -> Unit!Errno

    Loop

    type Loop

    Loop::alive

    fn Loop::alive(loop_ : Loop) -> Bool

    Loop::close

    fn Loop::close(loop_ : Loop) -> Unit!Errno

    Loop::fs_close

    fn Loop::fs_close(self : Loop, file : File, cb : (Fs) -> Unit) -> Unit!Errno

    Loop::fs_copyfile

    fn Loop::fs_copyfile[Ntbs : ToNtbs](self : Loop, path : Ntbs, new_path : Ntbs, flags : CopyFileFlags, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_fstat

    fn Loop::fs_fstat(self : Loop, file : File, k : (Fs, Stat) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_lstat

    fn Loop::fs_lstat[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs, Stat) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_mkdir

    fn Loop::fs_mkdir[Ntbs : ToNtbs](self : Loop, path : Ntbs, mode : Int, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_open

    fn Loop::fs_open[Ntbs : ToNtbs](self : Loop, path : Ntbs, flags : OpenFlags, mode : Int, open_cb : (Fs, File) -> Unit, error_cb : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_read

    fn Loop::fs_read(self : Loop, file : File, bufs : Array[
    View
    ], offset~ : Int64 = .., read_cb : (Fs, Int) -> Unit, error_cb : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_realpath

    fn Loop::fs_realpath[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs, String) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_rename

    fn Loop::fs_rename[Ntbs : ToNtbs](self : Loop, path : Ntbs, new_path : Ntbs, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_rmdir

    fn Loop::fs_rmdir[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_scandir

    fn Loop::fs_scandir[Ntbs : ToNtbs](self : Loop, path : Ntbs, flags : Int, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::fs_stat

    fn Loop::fs_stat[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs, Stat) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fn Loop::fs_unlink[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs) -> Unit, e : (Fs, Error) -> Unit) -> Unit!Errno

    Loop::fs_write

    fn Loop::fs_write(self : Loop, file : File, bufs : Array[
    View
    ], offset~ : Int64 = .., write_cb : (Fs, Int) -> Unit, error_cb : (Fs, Errno) -> Unit) -> Unit!Errno

    Loop::getaddrinfo

    fn Loop::getaddrinfo[Node : ToNtbs, Service : ToNtbs](self : Loop, getaddrinfo_cb : (GetAddrInfo, Iter[AddrInfo]) -> Unit, error_cb : (GetAddrInfo, Errno) -> Unit, node : Node, service : Service, hints? : AddrInfoHints) -> Unit!Errno

    Loop::new

    fn Loop::new() -> Loop!Errno

    Loop::queue_work

    fn Loop::queue_work(self : Loop, work_cb : (Work) -> Unit, after_cb : (Work) -> Unit, error_cb : (Work, Errno) -> Unit) -> Unit!Errno

    Loop::random

    fn Loop::random(self : Loop, buffer :
    View
    , flags : Int, random_cb : (Random,
    View
    ) -> Unit, error_cb : (Random, Errno) -> Unit) -> Unit!Errno

    Loop::run

    fn Loop::run(self : Loop, mode : RunMode) -> Unit!Errno

    Loop::spawn

    fn Loop::spawn(self : Loop, options : ProcessOptions) -> Process!Errno

    Loop::stop

    fn Loop::stop(self : Loop) -> Unit

    Mutex

    type Mutex

    impl Copy for Mutex

    Mutex::lock

    fn Mutex::lock(self : Mutex) -> Unit

    Mutex::new

    fn Mutex::new() -> Mutex!Errno

    Mutex::trylock

    fn Mutex::trylock(self : Mutex) -> Unit!Errno

    Mutex::unlock

    fn Mutex::unlock(self : Mutex) -> Unit

    OpenFlags

    type OpenFlags

    OpenFlags::read

    fn OpenFlags::read(create~ : Bool = ..) -> OpenFlags

    OpenFlags::read_write

    fn OpenFlags::read_write(create~ : Bool = ..) -> OpenFlags

    OpenFlags::write

    fn OpenFlags::write(create~ : Bool = ..) -> OpenFlags

    Pipe

    type Pipe

    impl ToHandle for Pipe
    impl ToStream for Pipe

    Pipe::bind

    fn Pipe::bind[Ntbs : ToNtbs](self : Pipe, name : Ntbs, flags : PipeBindFlags) -> Unit!Errno

    Pipe::new

    fn Pipe::new(self : Loop, ipc~ : Bool = ..) -> Pipe!Errno

    Pipe::to_handle

    fn Pipe::to_handle(self : Pipe) -> Handle

    Pipe::to_stream

    fn Pipe::to_stream(self : Pipe) -> Stream

    PipeBindFlags

    type PipeBindFlags

    PipeBindFlags::new

    fn PipeBindFlags::new(truncate~ : Bool = ..) -> PipeBindFlags

    Process

    type Process

    impl ToHandle for Process

    Process::kill

    fn Process::kill(self : Process, signum : Int) -> Unit!Errno

    Process::pid

    fn Process::pid(self : Process) -> Int

    ProcessOptions

    type ProcessOptions

    ProcessOptions::new

    Protocol

    pub enum Protocol {
    TCP
    UDP
    }

    impl Show for Protocol

    Protocol::tcp

    fn Protocol::tcp() -> Protocol

    Protocol::udp

    fn Protocol::udp() -> Protocol

    Random

    type Random

    Req

    type Req

    RunMode

    pub(all) enum RunMode {
    Default
    Once
    NoWait
    }

    Shutdown

    type Shutdown

    impl ToReq for Shutdown

    Signal

    type Signal

    Signal::new

    fn Signal::new(self : Loop) -> Signal!Errno

    Signal::start

    fn Signal::start(self : Signal, cb : (Signal, Signum) -> Unit, signum : Signum) -> Unit!Errno

    Signal::stop

    fn Signal::stop(self : Signal) -> Unit!Errno

    Signum

    type Signum

    Signum::sigabrt

    fn Signum::sigabrt() -> Signum

    Signum::sighup

    fn Signum::sighup() -> Signum

    Signum::sigint

    fn Signum::sigint() -> Signum

    Signum::sigpipe

    fn Signum::sigpipe() -> Signum?

    Signum::sigquit

    fn Signum::sigquit() -> Signum

    Signum::sigterm

    fn Signum::sigterm() -> Signum

    Signum::sigwinch

    fn Signum::sigwinch() -> Signum

    SockType

    type SockType

    impl Show for SockType

    SockType::dgram

    fn SockType::dgram() -> SockType

    SockType::raw

    fn SockType::raw() -> SockType

    SockType::stream

    fn SockType::stream() -> SockType

    Sockaddr

    type Sockaddr

    Sockaddr::ip_name

    fn Sockaddr::ip_name(self : Sockaddr) -> String!Errno

    SockaddrIn

    type SockaddrIn

    Stat

    type Stat

    Stat::atim_nsec

    fn Stat::atim_nsec(self : Stat) -> Int64

    Stat::atim_sec

    fn Stat::atim_sec(self : Stat) -> Int64

    Stat::birthtim_nsec

    fn Stat::birthtim_nsec(self : Stat) -> Int64

    Stat::birthtim_sec

    fn Stat::birthtim_sec(self : Stat) -> Int64

    Stat::blksize

    fn Stat::blksize(self : Stat) -> UInt64

    Stat::blocks

    fn Stat::blocks(self : Stat) -> UInt64

    Stat::ctim_nsec

    fn Stat::ctim_nsec(self : Stat) -> Int64

    Stat::ctim_sec

    fn Stat::ctim_sec(self : Stat) -> Int64

    Stat::dev

    fn Stat::dev(self : Stat) -> UInt64

    Stat::flags

    fn Stat::flags(self : Stat) -> UInt64

    Stat::gen

    fn Stat::gen(self : Stat) -> UInt64

    Stat::gid

    fn Stat::gid(self : Stat) -> UInt64

    Stat::ino

    fn Stat::ino(self : Stat) -> UInt64

    Stat::is_block_device

    fn Stat::is_block_device(self : Stat) -> Bool

    Stat::is_character_device

    fn Stat::is_character_device(self : Stat) -> Bool

    Stat::is_directory

    fn Stat::is_directory(self : Stat) -> Bool

    Stat::is_file

    fn Stat::is_file(self : Stat) -> Bool

    Stat::is_pipe

    fn Stat::is_pipe(self : Stat) -> Bool

    Stat::is_socket

    fn Stat::is_socket(self : Stat) -> Bool

    fn Stat::is_symlink(self : Stat) -> Bool

    Stat::mode

    fn Stat::mode(self : Stat) -> UInt64

    Stat::mtim_nsec

    fn Stat::mtim_nsec(self : Stat) -> Int64

    Stat::mtim_sec

    fn Stat::mtim_sec(self : Stat) -> Int64

    fn Stat::nlink(self : Stat) -> UInt64

    Stat::rdev

    fn Stat::rdev(self : Stat) -> UInt64

    Stat::size

    fn Stat::size(self : Stat) -> UInt64

    Stat::uid

    fn Stat::uid(self : Stat) -> UInt64

    Status

    pub enum Status {
    E2BIG
    EACCES
    EADDRINUSE
    EADDRNOTAVAIL
    EAFNOSUPPORT
    EAGAIN
    EAI_ADDRFAMILY
    EAI_AGAIN
    EAI_BADFLAGS
    EAI_BADHINTS
    EAI_CANCELED
    EAI_FAIL
    EAI_FAMILY
    EAI_MEMORY
    EAI_NODATA
    EAI_NONAME
    EAI_OVERFLOW
    EAI_PROTOCOL
    EAI_SERVICE
    EAI_SOCKTYPE
    EALREADY
    EBADF
    EBUSY
    ECANCELED
    ECHARSET
    ECONNABORTED
    ECONNREFUSED
    ECONNRESET
    EDESTADDRREQ
    EEXIST
    EFAULT
    EFBIG
    EHOSTUNREACH
    EINTR
    EINVAL
    EIO
    EISCONN
    EISDIR
    ELOOP
    EMFILE
    EMSGSIZE
    ENAMETOOLONG
    ENETDOWN
    ENETUNREACH
    ENFILE
    ENOBUFS
    ENODEV
    ENOENT
    ENOMEM
    ENONET
    ENOPROTOOPT
    ENOSPC
    ENOSYS
    ENOTCONN
    ENOTDIR
    ENOTEMPTY
    ENOTSOCK
    ENOTSUP
    EOVERFLOW
    EPERM
    EPIPE
    EPROTO
    EPROTONOSUPPORT
    EPROTOTYPE
    ERANGE
    EROFS
    ESHUTDOWN
    ESPIPE
    ESRCH
    ETIMEDOUT
    ETXTBSY
    EXDEV
    UNKNOWN
    EOF
    ENXIO
    EMLINK
    EHOSTDOWN
    EREMOTEIO
    ENOTTY
    EFTYPE
    EILSEQ
    ESOCKTNOSUPPORT
    ENODATA
    EUNATCH
    ENOEXEC
    }

    impl Eq for Status
    impl Hash for Status

    StdioContainer

    type StdioContainer

    StdioContainer::create_pipe

    fn StdioContainer::create_pipe[Stream : ToStream + ToHandle](stream : Stream, readable~ : Bool = .., writable~ : Bool = .., non_block~ : Bool = ..) -> StdioContainer

    StdioContainer::ignore

    StdioContainer::inherit_file

    fn StdioContainer::inherit_file(file : File) -> StdioContainer

    StdioContainer::inherit_stream

    fn StdioContainer::inherit_stream(stream : Stream) -> StdioContainer

    Stream

    type Stream

    impl ToHandle for Stream
    impl ToStream for Stream

    Stream::is_readable

    fn Stream::is_readable(self : Stream) -> Bool

    Stream::is_writable

    fn Stream::is_writable(self : Stream) -> Bool

    Stream::read_start

    fn Stream::read_start(self : Stream, alloc_cb : (Handle, Int) ->
    View
    , read_cb : (Stream, Int,
    View
    ) -> Unit, error_cb : (Stream, Errno) -> Unit) -> Unit!Errno

    Stream::read_stop

    fn Stream::read_stop(self : Stream) -> Unit!Errno

    Stream::shutdown

    fn Stream::shutdown(self : Stream, shutdown_cb : (Shutdown) -> Unit, error_cb : (Shutdown, Errno) -> Unit) -> Unit!Errno

    Stream::to_handle

    fn Stream::to_handle(self : Stream) -> Handle

    Stream::write

    fn Stream::write(self : Stream, bufs : Array[
    View
    ], write_cb : (Write) -> Unit, error_cb : (Write, Errno) -> Unit) -> Unit!Errno

    Tcp

    type Tcp

    impl ToHandle for Tcp
    impl ToStream for Tcp

    Tcp::bind

    fn Tcp::bind[Sockaddr : ToSockaddr](self : Tcp, addr : Sockaddr, flags : TcpBindFlags) -> Unit!Errno

    Tcp::connect

    fn Tcp::connect[Sockaddr : ToSockaddr](self : Tcp, addr : Sockaddr, connect_cb : (Connect) -> Unit, error_cb : (Connect, Errno) -> Unit) -> Unit!Errno

    Tcp::new

    fn Tcp::new(loop_ : Loop) -> Tcp!Errno

    TcpBindFlags

    type TcpBindFlags

    TcpBindFlags::new

    fn TcpBindFlags::new(ipv6_only~ : Bool = .., reuse_port~ : Bool = ..) -> TcpBindFlags

    Thread

    type Thread

    impl Copy for Thread

    Thread::current

    fn Thread::current() -> Thread

    Thread::equal

    fn Thread::equal(self : Thread, other : Thread) -> Bool

    Thread::join

    fn Thread::join(self : Thread) -> Unit!Errno

    Thread::new

    fn Thread::new(callback : () -> Unit) -> Thread!Errno

    Timer

    type Timer

    impl ToHandle for Timer

    Timer::get_due_in

    fn Timer::get_due_in(self : Timer) -> UInt64

    Timer::get_repeat

    fn Timer::get_repeat(self : Timer) -> UInt64

    Timer::new

    fn Timer::new(self : Loop) -> Timer!Errno

    Timer::set_repeat

    fn Timer::set_repeat(self : Timer, repeat : UInt64) -> Unit

    Timer::start

    fn Timer::start(self : Timer, timeout~ : UInt64, repeat~ : UInt64, cb : (Timer) -> Unit) -> Unit!Errno

    Timer::stop

    fn Timer::stop(self : Timer) -> Unit!Errno

    Tty

    type Tty

    impl ToHandle for Tty
    impl ToStream for Tty

    Tty::new

    fn Tty::new(self : Loop, file : File) -> Tty!Errno

    Tty::reset_mode

    fn Tty::reset_mode() -> Unit!Errno

    Tty::set_mode

    fn Tty::set_mode(self : Tty, mode : TtyMode) -> Unit!Errno

    TtyMode

    type TtyMode

    TtyMode::io

    fn TtyMode::io() -> TtyMode

    TtyMode::normal

    fn TtyMode::normal() -> TtyMode

    TtyMode::raw

    fn TtyMode::raw() -> TtyMode

    TtyMode::raw_vt

    fn TtyMode::raw_vt() -> TtyMode

    Udp

    type Udp

    impl ToHandle for Udp

    Udp::bind

    fn Udp::bind[Sockaddr : ToSockaddr](self : Udp, addr : Sockaddr, flags : UdpFlags) -> Unit!Errno

    Udp::connect

    fn Udp::connect[Sockaddr : ToSockaddr](self : Udp, addr : Sockaddr) -> Unit!Errno

    Udp::new

    fn Udp::new(loop_ : Loop) -> Udp!Errno

    Udp::recv_start

    fn Udp::recv_start(self : Udp, alloc_cb : (Handle, Int) ->
    View
    , read_cb : (Udp, Int,
    View
    , Sockaddr, UdpFlags) -> Unit, error_cb : (Udp, Errno) -> Unit) -> Unit!Errno

    Udp::recv_stop

    fn Udp::recv_stop(self : Udp) -> Unit!Errno

    Udp::send

    fn Udp::send[Sockaddr : ToSockaddr](self : Udp, data : Array[
    View
    ], send_cb : (UdpSend) -> Unit, error_cb : (UdpSend, Errno) -> Unit, addr? : Sockaddr) -> Unit!Errno

    UdpFlags

    type UdpFlags

    UdpFlags::new

    fn UdpFlags::new() -> UdpFlags

    UdpSend

    type UdpSend

    impl ToReq for UdpSend

    Uid

    type Uid

    Utsname

    type Utsname

    Utsname::machine

    fn Utsname::machine(self : Utsname) -> String

    Utsname::release

    fn Utsname::release(self : Utsname) -> String

    Utsname::sysname

    fn Utsname::sysname(self : Utsname) -> String

    Utsname::version

    fn Utsname::version(self : Utsname) -> String

    Work

    type Work

    Write

    type Write

    impl ToReq for Write

    accept

    fn accept[Server : ToStream + ToHandle, Client : ToStream + ToHandle](server : Server, client : Client) -> Unit!Errno

    args

    fn args() -> Array[String]

    argv

    fn argv() -> Array[Bytes]

    close

    fn close[Handle : ToHandle](handle : Handle, cb : (Handle) -> Unit) -> Unit

    cwd

    fn cwd() -> String!Errno

    disable_stdio_inheritance

    fn disable_stdio_inheritance() -> Unit

    errno

    fn errno(errno : Int) -> Errno

    fs_close

    fn fs_close(self : Loop, file : File, cb : (Fs) -> Unit) -> Unit!Errno

    fs_copyfile

    fn fs_copyfile[Ntbs : ToNtbs](self : Loop, path : Ntbs, new_path : Ntbs, flags : CopyFileFlags, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_fstat

    fn fs_fstat(self : Loop, file : File, k : (Fs, Stat) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_lstat

    fn fs_lstat[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs, Stat) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_mkdir

    fn fs_mkdir[Ntbs : ToNtbs](self : Loop, path : Ntbs, mode : Int, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_open

    fn fs_open[Ntbs : ToNtbs](self : Loop, path : Ntbs, flags : OpenFlags, mode : Int, open_cb : (Fs, File) -> Unit, error_cb : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_read

    fn fs_read(self : Loop, file : File, bufs : Array[
    View
    ], offset~ : Int64 = .., read_cb : (Fs, Int) -> Unit, error_cb : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_realpath

    fn fs_realpath[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs, String) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_rename

    fn fs_rename[Ntbs : ToNtbs](self : Loop, path : Ntbs, new_path : Ntbs, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_rmdir

    fn fs_rmdir[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_scandir

    fn fs_scandir[Ntbs : ToNtbs](self : Loop, path : Ntbs, flags : Int, k : (Fs) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fs_scandir_next

    fn fs_scandir_next(req : Fs) -> Dirent!Errno

    fs_stat

    fn fs_stat[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs, Stat) -> Unit, e : (Fs, Errno) -> Unit) -> Unit!Errno

    fn fs_unlink[Ntbs : ToNtbs](self : Loop, path : Ntbs, k : (Fs) -> Unit, e : (Fs, Error) -> Unit) -> Unit!Errno

    fs_write

    fn fs_write(self : Loop, file : File, bufs : Array[
    View
    ], offset~ : Int64 = .., write_cb : (Fs, Int) -> Unit, error_cb : (Fs, Errno) -> Unit) -> Unit!Errno

    getaddrinfo

    fn getaddrinfo[Node : ToNtbs, Service : ToNtbs](self : Loop, getaddrinfo_cb : (GetAddrInfo, Iter[AddrInfo]) -> Unit, error_cb : (GetAddrInfo, Errno) -> Unit, node : Node, service : Service, hints? : AddrInfoHints) -> Unit!Errno

    hrtime

    fn hrtime() -> UInt64

    ip4_addr

    fn ip4_addr[Ntbs : ToNtbs](ip : Ntbs, port : Int) -> SockaddrIn

    ip_name

    fn ip_name(self : Sockaddr) -> String!Errno

    is_closing

    fn is_closing[Handle : ToHandle](handle : Handle) -> Bool

    is_readable

    fn is_readable[Stream : ToStream + ToHandle](stream : Stream) -> Bool

    is_writable

    fn is_writable[Stream : ToStream + ToHandle](stream : Stream) -> Bool

    listen

    fn listen[Stream : ToStream + ToHandle](stream : Stream, backlog : Int, connection_cb : (Stream) -> Unit, error_cb : (Stream, Errno) -> Unit) -> Unit!Errno

    os_uname

    fn os_uname() -> Utsname!Errno

    pipe

    fn pipe(read_flags : Int, write_flags : Int) -> (File, File)!Errno

    queue_work

    fn queue_work(self : Loop, work_cb : (Work) -> Unit, after_cb : (Work) -> Unit, error_cb : (Work, Errno) -> Unit) -> Unit!Errno

    random

    fn random(self : Loop, buffer :
    View
    , flags : Int, random_cb : (Random,
    View
    ) -> Unit, error_cb : (Random, Errno) -> Unit) -> Unit!Errno

    read_start

    fn read_start[Stream : ToStream + ToHandle](stream : Stream, alloc_cb : (Stream, Int) ->
    View
    , read_cb : (Stream, Int,
    View
    ) -> Unit, error_cb : (Stream, Errno) -> Unit) -> Unit!Errno

    read_stop

    fn read_stop[Stream : ToStream + ToHandle](stream : Stream) -> Unit!Errno

    run

    fn run(self : Loop, mode : RunMode) -> Unit!Errno

    shutdown

    fn shutdown[Stream : ToStream + ToHandle](stream : Stream, shutdown_cb : (Shutdown) -> Unit, error_cb : (Shutdown, Errno) -> Unit) -> Unit!Errno

    sleep

    fn sleep(milliseconds : UInt) -> Unit

    spawn

    fn spawn(self : Loop, options : ProcessOptions) -> Process!Errno

    stderr

    fn stderr() -> File

    stdin

    fn stdin() -> File

    stdout

    fn stdout() -> File

    stop

    fn stop(self : Loop) -> Unit

    write

    fn write[Stream : ToStream + ToHandle](stream : Stream, bufs : Array[
    View
    ], write_cb : (Write) -> Unit, error_cb : (Write, Errno) -> Unit) -> Unit!Errno