MoonBit binding to libuv
Dependencies
moon update
moon add tonyfettes/uv{
"import": [
"tonyfettes/uv"
]
}fn main {
try {
let uv = @uv.Loop::new()
let options = @uv.ProcessOptions::new(
"moon",
["moon", "version"],
fn(process, exit_status, term_signal) {
println(
"Process exited with status \{exit_status} and signal \{term_signal}",
)
process.close(() => ())
},
)
let process = uv.spawn(options)
println("Launched process with ID \{(process).pid()}")
uv.run(Default)
uv.stop()
uv.close()
} catch {
error => println("Error: \{error}")
}
}pub trait Share {
share(Self) -> Self
} (thread 0) (thread 1)
+--------+ +--------+
| rc (M) | | rc (M) |
+--------+ +--------+
\ /
\---> +---------+ <---/
| arc (F) |
+---------+
| mutex |
+---------+
| payload |
+---------+pub trait ToHandle {
to_handle(Self) -> Handle
of_handle(Handle) -> Self
close(Self, () -> Unit) -> Unit
is_closing(Self) -> Bool
loop_(Self) -> Loop
fileno(Self) -> OsFd raise Errno
os_sock(Self) -> OsSock raise Errno
get_send_buffer_size(Self) -> Int raise Errno
set_send_buffer_size(Self, Int) -> Unit raise Errno
get_recv_buffer_size(Self) -> Int raise Errno
set_recv_buffer_size(Self, Int) -> Unit raise Errno
}pub trait ToStream : ToHandle {
to_stream(Self) -> Stream
of_stream(Stream) -> Self
read_start(Self, (Self, Int) -> BytesView, (Self, Int, BytesView) -> Unit, (Self, Errno) -> Unit) -> Unit raise Errno
read_stop(Self) -> Unit raise Errno
write(Self, Array[BytesView], () -> Unit, (Errno) -> Unit) -> Write raise Errno
try_write(Self, Array[BytesView], () -> Unit, (Errno) -> Unit) -> Write raise Errno
listen(Self, Int, (Self) -> Unit, (Self, Errno) -> Unit) -> Unit raise Errno
is_readable(Self) -> Bool
is_writable(Self) -> Bool
shutdown(Self, () -> Unit, (Errno) -> Unit) -> Shutdown raise Errno
set_blocking(Self, Bool) -> Unit raise Errno
write_queue_size(Self) -> UInt64
}pub(all) suberror Errno {
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
}type AccessFlagstype AddrInfotype AddrInfoFlagsfn AddrInfoFlags::new(passive? : Bool, canonname? : Bool, numeric_host? : Bool, numeric_serv? : Bool, all? : Bool, addrconfig? : Bool, v4mapped? : Bool) -> AddrInfoFlagstype AddrInfoHintsfn AddrInfoHints::new(flags? : AddrInfoFlags, family? : AddressFamily, socktype? : SockType, protocol? : Protocol) -> AddrInfoHintspub(all) enum AddressFamily {
Inet
Inet6
}let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
@assert.t(ipv4 is Inet)
@assert.t(ipv6 is Inet6)type Asynctype Barriertype Checklet uv = @uv.Loop::new()
let check = @uv.Check::new(uv)
let errors = []
check.start(fn(_) {
println("Check callback running")
check.stop() catch {
error => errors.push(error)
}
check.close(() => ())
})
uv.fs_open(
"test/fixtures/example.txt",
@uv.OpenFlags::read_only(),
0o644,
_ => (),
error => errors.push(error),
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}type Condtype CopyFileFlagstype CpuInfotype CpuSettype CpuTimestype Direntpub enum DirentType {
Unknown
File
Dir
Link
Fifo
Socket
Char
Block
}type Environtype Filetype FsEventfn FsEvent::start(self : FsEvent, path : Bytes, flags : FsEventFlags, event_cb : (FsEvent, Bytes?, Array[FsEventType]) -> Unit, error_cb : (FsEvent, Bytes?, Errno) -> Unit) -> Unit raise Errnotype FsEventFlagstype FsPollpub(all) type Gid UInt64type Grouptype Handlepub enum HandleType {
Unknown
Async
Check
FsEvent
FsPoll
Handle
Idle
Pipe
Poll
Prepare
Process
Stream
Tcp
Timer
Tty
Udp
Signal
File
}type Idlelet uv = @uv.Loop::new()
let errors = []
let idle = @uv.Idle::new(uv)
idle.start(fn(_) {
println("Idle callback running")
idle.stop() catch {
error => errors.push(error)
}
idle.close(() => ())
})
uv.run(Default)
uv.close()
for error in errors {
raise error
}type IfIndextype In6Addrtype InAddrtype Keytype Libtype Looplet uv = @uv.Loop::new()
uv.close()#as_free_fn
fn Loop::fs_access_sync(self : Loop, path : Bytes, mode : AccessFlags) -> Unit raise Errnolet uv = @uv.Loop::new()
let errors = []
let path : Bytes = "test/fixtures/example-chmod.txt"
uv.fs_chmod(
path,
0o644, // rw-r--r--
() => (),
error => errors.push(error)
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let path : Bytes = "test/fixtures/example-chmod-sync.txt"
uv.fs_chmod_sync(path, 0o644) // rw-r--r--
uv.close()let uv = @uv.Loop::new()
let errors = []
let path : Bytes = "test/fixtures/example.txt"
let passwd = @uv.os_get_passwd()
uv.fs_chown(
path,
passwd.uid(),
passwd.gid(),
() => println("Ownership changed successfully"),
error => errors.push(error)
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let path : Bytes = "test/fixtures/example.txt"
let passwd = @uv.os_get_passwd()
uv.fs_chown_sync(path, passwd.uid(), passwd.gid())
uv.close()let uv = Loop::new()
let errors = []
let file = uv.fs_open_sync("README.md", OpenFlags::read_only(), 0o644)
uv.fs_close(
file,
() => println("File closed successfully"),
(error) => errors.push(error),
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}#as_free_fn
fn Loop::fs_copyfile_sync(self : Loop, path : Bytes, new_path : Bytes, flags : CopyFileFlags) -> Unit raise Errnolet uv = @uv.Loop::new()
let errors = []
let path : Bytes = "test/fixtures/example-fchmod.txt"
let file = uv.fs_open_sync(path, @uv.OpenFlags::read_write(), 0o644)
uv.fs_fchmod(
file,
0o600, // rw-------
() => {
try uv.fs_close_sync(file) catch { e => errors.push(e) }
},
error => {
errors.push(error)
try uv.fs_close_sync(file) catch { e => errors.push(e) }
}
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let path : Bytes = "test/fixtures/example-fchmod-sync.txt"
let file = uv.fs_open_sync(path, @uv.OpenFlags::read_write(), 0o644)
uv.fs_fchmod_sync(file, 0o600) // rw-------
uv.fs_close_sync(file)
uv.close()let uv = @uv.Loop::new()
let errors = []
let path : Bytes = "test/fixtures/example.txt"
let passwd = @uv.os_get_passwd()
let file = uv.fs_open_sync(path, @uv.OpenFlags::read_write(), 0o644)
uv.fs_fchown(
file,
passwd.uid(),
passwd.gid(),
() => {
try uv.fs_close_sync(file) catch { e => errors.push(e) }
},
error => {
errors.push(error)
try uv.fs_close_sync(file) catch { e => errors.push(e) }
}
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let path : Bytes = "test/fixtures/example.txt"
let file = uv.fs_open_sync(path, @uv.OpenFlags::read_write(), 0o644)
let passwd = @uv.os_get_passwd()
// Change to user ID 1000 and group ID 1000
uv.fs_fchown_sync(file, passwd.uid(), passwd.gid())
uv.fs_close_sync(file)
uv.close()let uv = @uv.Loop::new()
let errors = []
let path : Bytes = "test/fixtures/datasync-test.txt"
let file = uv.fs_open_sync(
path,
@uv.OpenFlags::write_only(create=true),
0o644
)
let data : Bytes = "Hello, World!"
uv.fs_write_sync(file, [data])
uv.fs_fdatasync(
file,
() => println("File data synced successfully"),
error => errors.push(error),
)
|> ignore()
uv.run(Default)
uv.fs_close_sync(file)
uv.fs_unlink_sync(path)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let path : Bytes = "test/fixtures/datasync-test-sync.txt"
let file = uv.fs_open_sync(
path,
@uv.OpenFlags::write_only(create=true),
0o644
)
let data : Bytes = "Hello, World!"
uv.fs_write_sync(file, [data])
uv.fs_fdatasync_sync(file)
uv.fs_close_sync(file)
uv.fs_unlink_sync(path)
uv.close()let uv = @uv.Loop::new()
let errors = []
let path : Bytes = "test/fixtures/sync-test.txt"
let file = uv.fs_open_sync(
path,
@uv.OpenFlags::write_only(create=true),
0o644
)
let data : Bytes = "Hello, World!"
uv.fs_write_sync(file, [data])
uv.fs_fsync(
file,
() => println("File synced successfully"),
error => errors.push(error),
)
|> ignore()
uv.run(Default)
uv.fs_close_sync(file)
uv.fs_unlink_sync(path)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let path : Bytes = "test/fixtures/sync-test-sync.txt"
let file = uv.fs_open_sync(
path,
@uv.OpenFlags::write_only(create=true),
0o644
)
let data : Bytes = "Hello, World!"
uv.fs_write_sync(file, [data])
uv.fs_fsync_sync(file)
uv.fs_close_sync(file)
uv.fs_unlink_sync(path)
uv.close()let uv = @uv.Loop::new()
let errors = []
let target_file : Bytes = "test/fixtures/example.txt"
let symlink_file : Bytes = "test/fixtures/example-lchown.txt"
let passwd = @uv.os_get_passwd()
// First create a symlink
uv.fs_symlink_sync(target_file, symlink_file, @uv.SymlinkFlags::new())
uv.fs_lchown(
symlink_file,
passwd.uid(),
passwd.gid(),
() => {
try uv.fs_unlink_sync(symlink_file) catch { e => errors.push(e) }
},
error => {
errors.push(error)
try uv.fs_unlink_sync(symlink_file) catch { e => errors.push(e) }
}
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let target_file : Bytes = "test/fixtures/example.txt"
let symlink_file : Bytes = "test/fixtures/example-lchown-sync.txt"
let passwd = @uv.os_get_passwd()
uv.fs_symlink_sync(target_file, symlink_file, @uv.SymlinkFlags::new())
uv.fs_lchown_sync(symlink_file, passwd.uid(), passwd.gid())
uv.fs_unlink_sync(symlink_file)
uv.close()let uv = @uv.Loop::new()
let errors = []
let original_file : Bytes = "test/fixtures/example.txt"
let link_file : Bytes = "test/fixtures/example-link.txt"
uv.fs_link(
original_file,
link_file,
() => {
println("Hard link created successfully")
try uv.fs_unlink_sync(link_file) catch { e => errors.push(e) }
},
error => errors.push(error)
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let original_file : Bytes = "test/fixtures/example.txt"
let link_file : Bytes = "test/fixtures/example-link-sync.txt"
uv.fs_link_sync(original_file, link_file)
// Verify the link exists
let stat = uv.fs_stat_sync(link_file)
@assert.t(stat.is_file())
// Clean up
uv.fs_unlink_sync(link_file)
uv.close()let uv = @uv.Loop::new()
let target_file : Bytes = "test/fixtures/example.txt"
let symlink_file : Bytes = "test/fixtures/example-lstat.txt"
uv.fs_symlink_sync(target_file, symlink_file, @uv.SymlinkFlags::new())
let stat = uv.fs_lstat_sync(symlink_file)
@assert.t(stat.is_symlink())
uv.fs_unlink_sync(symlink_file)
uv.close()let uv = @uv.Loop::new()
let es = []
let dir : Bytes = "test/fixtures/doc-test-dir"
uv.fs_mkdir(
dir,
0o755,
() => println("Directory created successfully"),
(e) => es.push(e)
)
|> ignore()
uv.run(Default)
uv.fs_rmdir_sync(dir)
uv.close()
for e in es {
raise e
}let uv = @uv.Loop::new()
try {
uv.fs_mkdir_sync("test/fixtures", 0o755)
fail("Directory should not exist")
} catch {
Errno::EEXIST => ()
error => raise error
}
uv.close()let uv = Loop::new()
let errors = []
uv.fs_open(
"README.md",
OpenFlags::read_only(),
0o644,
file => uv.fs_close_sync(file) catch { _ => () },
(error) => errors.push(error),
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let file = uv.fs_open_sync("README.md", @uv.OpenFlags::read_only(), 0o644)
uv.fs_close_sync(file)
uv.close()let uv = @uv.Loop::new()
let errors = []
uv.fs_read(
@uv.stdin(),
[Bytes::make(100, 0)],
count => println("Read \{count} bytes"),
error => errors.push(error),
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let errors = []
let target_file : Bytes = "test/fixtures/example.txt"
let symlink_file : Bytes = "test/fixtures/example-symlink.txt"
// First create a symlink
uv.fs_symlink_sync(target_file, symlink_file, @uv.SymlinkFlags::new())
// Then read its target
uv.fs_readlink(
symlink_file,
target => {
println("Symlink points to: \{target}")
try {
@assert.eq(target, target_file)
uv.fs_unlink_sync(symlink_file)
} catch { e => errors.push(e) }
},
error => errors.push(error)
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let target_file : Bytes = "test/fixtures/example.txt"
let symlink_file : Bytes = "test/fixtures/example-symlink-sync.txt"
// First create a symlink
uv.fs_symlink_sync(target_file, symlink_file, @uv.SymlinkFlags::new())
// Then read its target
let target = uv.fs_readlink_sync(symlink_file)
@assert.eq(target, target_file)
// Clean up
uv.fs_unlink_sync(symlink_file)
uv.close()let uv = @uv.Loop::new()
let errors = []
uv.fs_realpath(
"test/fixtures/example.txt",
realpath => println("Resolved: \{realpath}"),
error => errors.push(error)
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
try {
uv.fs_rename_sync("old_file.txt", "new_file.txt")
println("File renamed successfully")
} catch {
error => println("Rename failed: " + error.to_string())
}
uv.close()let uv = @uv.Loop::new()
let errors = []
let dst_path : Bytes = "test/fixtures/example-sent.txt"
let src_file = uv.fs_open_sync("test/fixtures/example.txt", @uv.OpenFlags::read_only(), 0o644)
let dst_file = uv.fs_open_sync(dst_path, @uv.OpenFlags::write_only(create=true), 0o644)
uv.fs_sendfile(
dst_file,
src_file,
0L,
1024UL,
_ => {
try {
uv.fs_close_sync(src_file)
uv.fs_close_sync(dst_file)
uv.fs_unlink_sync(dst_path)
} catch { e => errors.push(e) }
},
error => {
errors.push(error)
try {
uv.fs_close_sync(src_file)
uv.fs_close_sync(dst_file)
uv.fs_unlink_sync(dst_path)
} catch { e => errors.push(e) }
}
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let dst_path : Bytes = "test/fixtures/example-sent.txt"
let src_file = uv.fs_open_sync("test/fixtures/example.txt", @uv.OpenFlags::read_only(), 0o644)
let dst_file = uv.fs_open_sync(dst_path, @uv.OpenFlags::write_only(create=true), 0o644)
let _ = uv.fs_sendfile_sync(dst_file, src_file, 0L, 1024UL)
uv.fs_close_sync(src_file)
uv.fs_close_sync(dst_file)
uv.fs_unlink_sync(dst_path)
uv.close()let uv = @uv.Loop::new()
let errors = []
let target_file : Bytes = "test/fixtures/example.txt"
let symlink_file : Bytes = "test/fixtures/example-symlink.txt"
uv.fs_symlink(
target_file,
symlink_file,
@uv.SymlinkFlags::new(),
() => {
println("Symbolic link created successfully")
try uv.fs_unlink_sync(symlink_file) catch { e => errors.push(e) }
},
error => errors.push(error)
)
|> ignore()
uv.run(Default)
uv.close()
for error in errors {
raise error
}#as_free_fn
fn Loop::fs_symlink_sync(self : Loop, path : Bytes, new_path : Bytes, flags : SymlinkFlags) -> Unit raise Errnolet uv = @uv.Loop::new()
let target_file : Bytes = "test/fixtures/example.txt"
let symlink_file : Bytes = "test/fixtures/example-symlink-sync.txt"
uv.fs_symlink_sync(target_file, symlink_file, @uv.SymlinkFlags::new())
// Verify the symlink exists
let stat = uv.fs_lstat_sync(symlink_file)
@assert.t(stat.is_symlink())
// Clean up
uv.fs_unlink_sync(symlink_file)
uv.close()let uv = @uv.Loop::new()
let errors = []
let path : Bytes = "test/fixtures/doc-test.txt"
let file = uv.fs_open_sync(
path,
@uv.OpenFlags::write_only(create=true),
0o644
)
let data : Bytes = "Hello, World!"
uv.fs_write(
file,
[data],
written => println("Wrote \{written} bytes"),
error => errors.push(error),
)
|> ignore()
uv.run(Default)
uv.fs_close_sync(file)
uv.fs_unlink_sync(path)
uv.close()
for error in errors {
raise error
}let uv = @uv.Loop::new()
let path : Bytes = "test/fixtures/doc-test-sync.txt"
let file = uv.fs_open_sync(
path,
@uv.OpenFlags::write_only(create=true),
0o644
)
let data : Bytes = "Hello, World!"
uv.fs_write_sync(file, [data])
uv.fs_close_sync(file)
uv.fs_unlink_sync(path)
uv.close()#as_free_fn
fn Loop::getaddrinfo(self : Loop, getaddrinfo_cb : (Iter[AddrInfo]) -> Unit, error_cb : (Errno) -> Unit, node : Bytes, service : Bytes, hints? : AddrInfoHints) -> GetAddrInfo raise Errnolet uv = @uv.Loop::new()
uv.close()let uv = @uv.Loop::new()
let buffer = Bytes::make(16, 0)
uv.random_sync(buffer[:], 0)
// buffer now contains random data
uv.close()let uv = @uv.Loop::new()
uv.run(Default)
uv.close()pub(all) enum Membership {
LeaveGroup
JoinGroup
}type Metricstype Mutextype Oncetype OpenFlagsfn OpenFlags::read_only(access_hint? : AccessHint, direct? : Bool, directory? : Bool, exclusive_lock? : Bool, filemap? : Bool, noatime? : Bool, nofollow? : Bool, nonblock? : Bool, symlink? : Bool) -> OpenFlagslet uv = @uv.Loop::new()
let flags = @uv.OpenFlags::read_only()
let file = uv.fs_open_sync("README.md", flags, 0o644)
uv.fs_close_sync(file)
uv.close()fn OpenFlags::read_write(access_hint? : AccessHint, append? : Bool, create? : Bool, direct? : Bool, exclusive? : Bool, exclusive_lock? : Bool, filemap? : Bool, noatime? : Bool, noctty? : Bool, nofollow? : Bool, nonblock? : Bool, symlink? : Bool, sync? : Sync, temporary? : Bool, truncate? : Bool) -> OpenFlagslet uv = @uv.Loop::new()
// Create a new file for reading and writing, fail if it exists
let flags = @uv.OpenFlags::read_write(create=true, exclusive=true)
let path : Bytes = "new_file.txt"
let file = uv.fs_open_sync(path, flags, 0o644)
uv.fs_close_sync(file)
uv.fs_unlink_sync(path)
uv.close()let uv = @uv.Loop::new()
// Create a new file for writing, truncate if it exists
let flags = @uv.OpenFlags::write_only(create=true, truncate=true)
let path : Bytes = "output.txt"
let file = uv.fs_open_sync(path, flags, 0o644)
uv.fs_close_sync(file)
uv.fs_unlink_sync(path)
uv.close()type Passwdtype PhysAddrtype Pidtype Pipetype PipeBindFlagstype PipeFlagstype Polltype PollEventtype Preparetype Processtype ProcessOptionsfn ProcessOptions::new(file : Bytes, args : Array[Bytes], env? : Array[Bytes], cwd? : Bytes, stdio? : Array[StdioContainer], uid? : Uid, gid? : Gid, exit_cb : (Process, Int64, Int) -> Unit) -> ProcessOptionspub(all) enum Protocol {
Tcp
Udp
}pub enum ReqType {
Unknown
Req
Connect
Write
Shutdown
UdpSend
Fs
Work
Getaddrinfo
Getnameinfo
Random
}type Rusage#alias(RWLock, deprecated="`RWLock` is deprecated, use `RwLock` instead")
type RwLocktype Scandirtype Semtype Signaltype Signumtype SockTypetype Sockaddrtype Stattype StatFstype StdioContainerfn[Stream : ToStream + ToHandle] StdioContainer::create_pipe(stream : Stream, readable? : Bool, writable? : Bool, non_block? : Bool) -> StdioContainertype Streamtype SymlinkFlags// Regular file symlink (works on all platforms)
ignore(@uv.SymlinkFlags::new())
// Directory symlink (needed on Windows for directories)
ignore(@uv.SymlinkFlags::new(dir=true))
// Junction point (Windows-specific)
ignore(@uv.SymlinkFlags::new(junction=true))type Tcpfn[Sockaddr : ToSockaddr + ToJson] Tcp::bind(self : Tcp, addr : Sockaddr, flags : TcpBindFlags) -> Unit raise Errnotype TcpBindFlagstype Threadtype Timerpub type Timespec64 FixedArray[Int64]#deprecated("Use `struct T(A)` to declare a newtype and use `.0` access the underlying type instead.")
fn Timespec64::inner(self : Timespec64) -> FixedArray[Int64]pub type Timeval64 FixedArray[Int64]type Ttytype TtyModepub enum TtyVtermState {
Supported
Unsupported
}type Udpfn Udp::set_membership(self : Udp, multicast_addr : Bytes, interface_addr : Bytes, membership : Membership) -> Unit raise Errnofn Udp::set_source_membership(self : Udp, multicast_addr : Bytes, interface_addr : Bytes, source_addr : Bytes, membership : Membership) -> Unit raise Errnotype UdpFlagspub(all) type Uid UInt64type Utsnametype Versionfn args() -> FixedArray[Bytes]println(@uv.args())#deprecated("Use Handle::close() instead")
fn[Handle : ToHandle] close(handle : Handle, cb : () -> Unit) -> Unitlet cpu_infos = @uv.cpu_info()
for cpu_info in cpu_infos {
println(cpu_info.model())
}fn hrtime() -> UInt64let addr = @uv.ip4_addr("127.0.0.1", 8080)
println(addr.ip_name())#deprecated("Use Handle::is_closing() instead")
fn[Handle : ToHandle] is_closing(handle : Handle) -> Boollet passwd = @uv.os_get_passwd()
println(passwd.username())
println(passwd.uid().0)
println(passwd.gid().0)
println(passwd.shell())println(@uv.os_tmpdir())let info = @uv.os_uname()
println(info.sysname())
println(info.release())
println(info.machine())MoonBit binding to libuv
Dependencies