1///|
2extern "c" fn strerror_r(err : Int
Int, bytes : Bytes
Bytes) = "moonbit_uv_strerror_r"
3
4///|
5fn (errno : Int) -> @string.StringView
strerror(Int
errno : Int
Int) -> type @string.StringView
A @string.View represents a view of a String that maintains proper Unicode
character boundaries. It allows safe access to a substring while handling
multi-byte characters correctly.
@string.View {
6 let Bytes
bytes = (Int, Byte) -> Bytes
Bytes::(len : Int, init : Byte) -> Bytes
Creates a new byte sequence of the specified length, where each byte is
initialized to the given value. Returns an empty byte sequence if the
length is negative.
Parameters:
length : The length of the byte sequence to create. Must be non-negative.
initial_value : The byte value used to initialize each position in the
sequence.
Example:
test "Bytes::make" {
let bytes = Bytes::make(3, b'\xFF')
inspect(bytes, content=
#|b"\xff\xff\xff"
)
let empty = Bytes::make(0, b'\x00')
inspect(empty, content="b\"\"")
}
make(256, 0)
7 (err : Int, bytes : Bytes) -> Unit
strerror_r(Int
errno, Bytes
bytes)
8 let @buffer.T
buffer = (size_hint~ : Int = ..) -> @buffer.T
Creates a new extensible buffer with specified initial capacity. If the
initial capacity is less than 1, the buffer will be initialized with capacity
1.
Parameters:
size_hint : Initial capacity of the buffer in bytes. Defaults to 0.
Returns a new buffer of type T.
Example:
test "new" {
let buf = @buffer.new(size_hint=10)
inspect(buf.length(), content="0")
buf.write_string("test")
inspect(buf.length(), content="8")
}
@buffer.new()
9 for Byte
byte in Bytes
bytes {
10 if Byte
byte (self : Byte, that : Byte) -> Bool
Compares two Byte values for equality.
Parameters:
self : The first Byte value to compare.
that : The second Byte value to compare.
Returns true if the two Byte values are equal, otherwise false.
== 0 {
11 break
12 }
13 @buffer.T
buffer.(self : @buffer.T, value : Byte) -> Unit
Writes a single byte to the end of the buffer. The buffer will automatically
grow if necessary to accommodate the new byte.
Parameters:
buffer : The buffer to write to.
byte : The byte value to be written.
Example:
test "write_byte" {
let buf = @buffer.new()
buf.write_byte(b'\x41')
inspect(buf.contents(), content="b\"\\x41\"")
}
write_byte(Byte
byte)
14 }
15 (encoding~ : @encoding.Encoding, input : @bytes.View) -> String
@encoding.decode_lossy(@encoding.Encoding
encoding=@encoding.Encoding
UTF8, @buffer.T
buffer.(self : @buffer.T) -> Bytes
Returns a copy of the buffer's contents as a Bytes object. The returned
bytes will have the same length as the buffer.
Parameters:
buffer : The buffer whose contents will be converted to bytes.
Returns a Bytes object containing a copy of the buffer's contents.
Example:
test "to_bytes" {
let buf = @buffer.new()
buf.write_string("Test")
let bytes = buf.to_bytes()
inspect(bytes.length(), content="8")
}
to_bytes())
16}
17
18///|
19pub enum Status {
20 Status
E2BIG
21 Status
EACCES
22 Status
EADDRINUSE
23 Status
EADDRNOTAVAIL
24 Status
EAFNOSUPPORT
25 Status
EAGAIN
26 Status
EAI_ADDRFAMILY
27 Status
EAI_AGAIN
28 Status
EAI_BADFLAGS
29 Status
EAI_BADHINTS
30 Status
EAI_CANCELED
31 Status
EAI_FAIL
32 Status
EAI_FAMILY
33 Status
EAI_MEMORY
34 Status
EAI_NODATA
35 Status
EAI_NONAME
36 Status
EAI_OVERFLOW
37 Status
EAI_PROTOCOL
38 Status
EAI_SERVICE
39 Status
EAI_SOCKTYPE
40 Status
EALREADY
41 Status
EBADF
42 Status
EBUSY
43 Status
ECANCELED
44 Status
ECHARSET
45 Status
ECONNABORTED
46 Status
ECONNREFUSED
47 Status
ECONNRESET
48 Status
EDESTADDRREQ
49 Status
EEXIST
50 Status
EFAULT
51 Status
EFBIG
52 Status
EHOSTUNREACH
53 Status
EINTR
54 Status
EINVAL
55 Status
EIO
56 Status
EISCONN
57 Status
EISDIR
58 Status
ELOOP
59 Status
EMFILE
60 Status
EMSGSIZE
61 Status
ENAMETOOLONG
62 Status
ENETDOWN
63 Status
ENETUNREACH
64 Status
ENFILE
65 Status
ENOBUFS
66 Status
ENODEV
67 Status
ENOENT
68 Status
ENOMEM
69 Status
ENONET
70 Status
ENOPROTOOPT
71 Status
ENOSPC
72 Status
ENOSYS
73 Status
ENOTCONN
74 Status
ENOTDIR
75 Status
ENOTEMPTY
76 Status
ENOTSOCK
77 Status
ENOTSUP
78 Status
EOVERFLOW
79 Status
EPERM
80 Status
EPIPE
81 Status
EPROTO
82 Status
EPROTONOSUPPORT
83 Status
EPROTOTYPE
84 Status
ERANGE
85 Status
EROFS
86 Status
ESHUTDOWN
87 Status
ESPIPE
88 Status
ESRCH
89 Status
ETIMEDOUT
90 Status
ETXTBSY
91 Status
EXDEV
92 Status
UNKNOWN
93 Status
EOF
94 Status
ENXIO
95 Status
EMLINK
96 Status
EHOSTDOWN
97 Status
EREMOTEIO
98 Status
ENOTTY
99 Status
EFTYPE
100 Status
EILSEQ
101 Status
ESOCKTNOSUPPORT
102 Status
ENODATA
103 Status
EUNATCH
104 Status
ENOEXEC
105} derive((Status, Status) -> Bool
Trait for types whose elements can test for equality
Eq, (Status, Hasher) -> Unit
Trait for types that can be hashed
Hash)
106
107///|
108pub type! Errno 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
}
Status derive((Errno, Errno) -> Bool
Trait for types whose elements can test for equality
Eq, (Errno, Hasher) -> Unit
Trait for types that can be hashed
Hash)
109
110///|
111let Map[Errno, @string.StringView]
errno_messages : type Map[K, V]
Mutable linked hash map that maintains the order of insertion, not thread safe.
Example
let map = { 3: "three", 8 : "eight", 1 : "one"}
assert_eq(map.get(2), None)
assert_eq(map.get(3), Some("three"))
map.set(3, "updated")
assert_eq(map.get(3), Some("updated"))
Map[type! Errno Status
Errno, type @string.StringView
A @string.View represents a view of a String that maintains proper Unicode
character boundaries. It allows safe access to a substring while handling
multi-byte characters correctly.
@string.View] = type Map[K, V]
Mutable linked hash map that maintains the order of insertion, not thread safe.
Example
let map = { 3: "three", 8 : "eight", 1 : "one"}
assert_eq(map.get(2), None)
assert_eq(map.get(3), Some("three"))
map.set(3, "updated")
assert_eq(map.get(3), Some("updated"))
Map::(capacity~ : Int = ..) -> Map[Errno, @string.StringView]
Create a hash map.
The capacity of the map will be the smallest power of 2 that is
greater than or equal to the provided [capacity].
new()
112
113///|
114let Map[Int, Errno]
errno_errors : type Map[K, V]
Mutable linked hash map that maintains the order of insertion, not thread safe.
Example
let map = { 3: "three", 8 : "eight", 1 : "one"}
assert_eq(map.get(2), None)
assert_eq(map.get(3), Some("three"))
map.set(3, "updated")
assert_eq(map.get(3), Some("updated"))
Map[Int
Int, type! Errno Status
Errno] = type Map[K, V]
Mutable linked hash map that maintains the order of insertion, not thread safe.
Example
let map = { 3: "three", 8 : "eight", 1 : "one"}
assert_eq(map.get(2), None)
assert_eq(map.get(3), Some("three"))
map.set(3, "updated")
assert_eq(map.get(3), Some("updated"))
Map::(capacity~ : Int = ..) -> Map[Int, Errno]
Create a hash map.
The capacity of the map will be the smallest power of 2 that is
greater than or equal to the provided [capacity].
new()
115
116///|
117let Map[Errno, Int]
errno_values : type Map[K, V]
Mutable linked hash map that maintains the order of insertion, not thread safe.
Example
let map = { 3: "three", 8 : "eight", 1 : "one"}
assert_eq(map.get(2), None)
assert_eq(map.get(3), Some("three"))
map.set(3, "updated")
assert_eq(map.get(3), Some("updated"))
Map[type! Errno Status
Errno, Int
Int] = type Map[K, V]
Mutable linked hash map that maintains the order of insertion, not thread safe.
Example
let map = { 3: "three", 8 : "eight", 1 : "one"}
assert_eq(map.get(2), None)
assert_eq(map.get(3), Some("three"))
map.set(3, "updated")
assert_eq(map.get(3), Some("updated"))
Map::(capacity~ : Int = ..) -> Map[Errno, Int]
Create a hash map.
The capacity of the map will be the smallest power of 2 that is
greater than or equal to the provided [capacity].
new()
118
119///|
120fn init {
121 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_E2BIG()] = (Status) -> Errno
Errno(Status::Status
E2BIG)
122 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EACCES()] = (Status) -> Errno
Errno(Status::Status
EACCES)
123 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EADDRINUSE()] = (Status) -> Errno
Errno(Status::Status
EADDRINUSE)
124 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EADDRNOTAVAIL()] = (Status) -> Errno
Errno(Status::Status
EADDRNOTAVAIL)
125 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAFNOSUPPORT()] = (Status) -> Errno
Errno(Status::Status
EAFNOSUPPORT)
126 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAGAIN()] = (Status) -> Errno
Errno(Status::Status
EAGAIN)
127 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_ADDRFAMILY()] = (Status) -> Errno
Errno(Status::Status
EAI_ADDRFAMILY)
128 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_AGAIN()] = (Status) -> Errno
Errno(Status::Status
EAI_AGAIN)
129 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_BADFLAGS()] = (Status) -> Errno
Errno(Status::Status
EAI_BADFLAGS)
130 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_BADHINTS()] = (Status) -> Errno
Errno(Status::Status
EAI_BADHINTS)
131 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_CANCELED()] = (Status) -> Errno
Errno(Status::Status
EAI_CANCELED)
132 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_FAIL()] = (Status) -> Errno
Errno(Status::Status
EAI_FAIL)
133 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_FAMILY()] = (Status) -> Errno
Errno(Status::Status
EAI_FAMILY)
134 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_MEMORY()] = (Status) -> Errno
Errno(Status::Status
EAI_MEMORY)
135 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_NODATA()] = (Status) -> Errno
Errno(Status::Status
EAI_NODATA)
136 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_NONAME()] = (Status) -> Errno
Errno(Status::Status
EAI_NONAME)
137 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_OVERFLOW()] = (Status) -> Errno
Errno(Status::Status
EAI_OVERFLOW)
138 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_PROTOCOL()] = (Status) -> Errno
Errno(Status::Status
EAI_PROTOCOL)
139 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_SERVICE()] = (Status) -> Errno
Errno(Status::Status
EAI_SERVICE)
140 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EAI_SOCKTYPE()] = (Status) -> Errno
Errno(Status::Status
EAI_SOCKTYPE)
141 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EALREADY()] = (Status) -> Errno
Errno(Status::Status
EALREADY)
142 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EBADF()] = (Status) -> Errno
Errno(Status::Status
EBADF)
143 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EBUSY()] = (Status) -> Errno
Errno(Status::Status
EBUSY)
144 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ECANCELED()] = (Status) -> Errno
Errno(Status::Status
ECANCELED)
145 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ECHARSET()] = (Status) -> Errno
Errno(Status::Status
ECHARSET)
146 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ECONNABORTED()] = (Status) -> Errno
Errno(Status::Status
ECONNABORTED)
147 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ECONNREFUSED()] = (Status) -> Errno
Errno(Status::Status
ECONNREFUSED)
148 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ECONNRESET()] = (Status) -> Errno
Errno(Status::Status
ECONNRESET)
149 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EDESTADDRREQ()] = (Status) -> Errno
Errno(Status::Status
EDESTADDRREQ)
150 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EEXIST()] = (Status) -> Errno
Errno(Status::Status
EEXIST)
151 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EFAULT()] = (Status) -> Errno
Errno(Status::Status
EFAULT)
152 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EFBIG()] = (Status) -> Errno
Errno(Status::Status
EFBIG)
153 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EHOSTUNREACH()] = (Status) -> Errno
Errno(Status::Status
EHOSTUNREACH)
154 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EINTR()] = (Status) -> Errno
Errno(Status::Status
EINTR)
155 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EINVAL()] = (Status) -> Errno
Errno(Status::Status
EINVAL)
156 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EIO()] = (Status) -> Errno
Errno(Status::Status
EIO)
157 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EISCONN()] = (Status) -> Errno
Errno(Status::Status
EISCONN)
158 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EISDIR()] = (Status) -> Errno
Errno(Status::Status
EISDIR)
159 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ELOOP()] = (Status) -> Errno
Errno(Status::Status
ELOOP)
160 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EMFILE()] = (Status) -> Errno
Errno(Status::Status
EMFILE)
161 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EMSGSIZE()] = (Status) -> Errno
Errno(Status::Status
EMSGSIZE)
162 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENAMETOOLONG()] = (Status) -> Errno
Errno(Status::Status
ENAMETOOLONG)
163 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENETDOWN()] = (Status) -> Errno
Errno(Status::Status
ENETDOWN)
164 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENETUNREACH()] = (Status) -> Errno
Errno(Status::Status
ENETUNREACH)
165 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENFILE()] = (Status) -> Errno
Errno(Status::Status
ENFILE)
166 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOBUFS()] = (Status) -> Errno
Errno(Status::Status
ENOBUFS)
167 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENODEV()] = (Status) -> Errno
Errno(Status::Status
ENODEV)
168 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOENT()] = (Status) -> Errno
Errno(Status::Status
ENOENT)
169 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOMEM()] = (Status) -> Errno
Errno(Status::Status
ENOMEM)
170 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENONET()] = (Status) -> Errno
Errno(Status::Status
ENONET)
171 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOPROTOOPT()] = (Status) -> Errno
Errno(Status::Status
ENOPROTOOPT)
172 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOSPC()] = (Status) -> Errno
Errno(Status::Status
ENOSPC)
173 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOSYS()] = (Status) -> Errno
Errno(Status::Status
ENOSYS)
174 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOTCONN()] = (Status) -> Errno
Errno(Status::Status
ENOTCONN)
175 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOTDIR()] = (Status) -> Errno
Errno(Status::Status
ENOTDIR)
176 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOTEMPTY()] = (Status) -> Errno
Errno(Status::Status
ENOTEMPTY)
177 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOTSOCK()] = (Status) -> Errno
Errno(Status::Status
ENOTSOCK)
178 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOTSUP()] = (Status) -> Errno
Errno(Status::Status
ENOTSUP)
179 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EOVERFLOW()] = (Status) -> Errno
Errno(Status::Status
EOVERFLOW)
180 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EPERM()] = (Status) -> Errno
Errno(Status::Status
EPERM)
181 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EPIPE()] = (Status) -> Errno
Errno(Status::Status
EPIPE)
182 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EPROTO()] = (Status) -> Errno
Errno(Status::Status
EPROTO)
183 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EPROTONOSUPPORT()] = (Status) -> Errno
Errno(Status::Status
EPROTONOSUPPORT)
184 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EPROTOTYPE()] = (Status) -> Errno
Errno(Status::Status
EPROTOTYPE)
185 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ERANGE()] = (Status) -> Errno
Errno(Status::Status
ERANGE)
186 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EROFS()] = (Status) -> Errno
Errno(Status::Status
EROFS)
187 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ESHUTDOWN()] = (Status) -> Errno
Errno(Status::Status
ESHUTDOWN)
188 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ESPIPE()] = (Status) -> Errno
Errno(Status::Status
ESPIPE)
189 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ESRCH()] = (Status) -> Errno
Errno(Status::Status
ESRCH)
190 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ETIMEDOUT()] = (Status) -> Errno
Errno(Status::Status
ETIMEDOUT)
191 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ETXTBSY()] = (Status) -> Errno
Errno(Status::Status
ETXTBSY)
192 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EXDEV()] = (Status) -> Errno
Errno(Status::Status
EXDEV)
193 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_UNKNOWN()] = (Status) -> Errno
Errno(Status::Status
UNKNOWN)
194 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EOF()] = (Status) -> Errno
Errno(Status::Status
EOF)
195 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENXIO()] = (Status) -> Errno
Errno(Status::Status
ENXIO)
196 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EMLINK()] = (Status) -> Errno
Errno(Status::Status
EMLINK)
197 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EHOSTDOWN()] = (Status) -> Errno
Errno(Status::Status
EHOSTDOWN)
198 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EREMOTEIO()] = (Status) -> Errno
Errno(Status::Status
EREMOTEIO)
199 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOTTY()] = (Status) -> Errno
Errno(Status::Status
ENOTTY)
200 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EFTYPE()] = (Status) -> Errno
Errno(Status::Status
EFTYPE)
201 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EILSEQ()] = (Status) -> Errno
Errno(Status::Status
EILSEQ)
202 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ESOCKTNOSUPPORT()] = (Status) -> Errno
Errno(Status::Status
ESOCKTNOSUPPORT)
203 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENODATA()] = (Status) -> Errno
Errno(Status::Status
ENODATA)
204 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_EUNATCH()] = (Status) -> Errno
Errno(Status::Status
EUNATCH)
205 Map[Int, Errno]
errno_errors(Map[Int, Errno], Int, Errno) -> Unit
[uv_ENOEXEC()] = (Status) -> Errno
Errno(Status::Status
ENOEXEC)
206 for Int
value, Errno
error in Map[Int, Errno]
errno_errors {
207 Map[Errno, Int]
errno_values(Map[Errno, Int], Errno, Int) -> Unit
[error] = Int
value
208 }
209}
210
211///|
212pub fn (errno : Int) -> Errno
errno(Int
errno : Int
Int) -> type! Errno Status
Errno {
213 Map[Int, Errno]
errno_errors.(self : Map[Int, Errno], key : Int) -> Errno?
Get the value associated with a key.
get(Int
errno).(self : Errno?, default : Errno) -> Errno
Return the contained Some value or the provided default.
or((Status) -> Errno
Errno(Status::Status
UNKNOWN))
214}
215
216///|
217fn type! Errno Status
Errno::(errno : Int) -> Errno
of_int(Int
errno : Int
Int) -> type! Errno Status
Errno {
218 Map[Int, Errno]
errno_errors.(self : Map[Int, Errno], key : Int) -> Errno?
Get the value associated with a key.
get(Int
errno).(self : Errno?, default : Errno) -> Errno
Return the contained Some value or the provided default.
or((Status) -> Errno
Errno(Status::Status
UNKNOWN))
219}
220
221///|
222fn type! Errno Status
Errno::(self : Errno) -> Int
to_int(Errno
self : type! Errno Status
Errno) -> Int
Int {
223 Map[Errno, Int]
errno_values.(self : Map[Errno, Int], key : Errno) -> Int?
Get the value associated with a key.
get(Errno
self).(self : Int?, default : Int) -> Int
Return the contained Some value or the provided default.
or(() -> Int
uv_UNKNOWN())
224}
225
226///|
227pub impl trait Show {
output(Self, &Logger) -> Unit
to_string(Self) -> String
}
Trait for types that can be converted to String
Show for type! Errno Status
Errno with (self : Errno, logger : &Logger) -> Unit
output(Errno
self : type! Errno Status
Errno, &Logger
logger : &trait Logger {
write_string(Self, String) -> Unit
write_substring(Self, String, Int, Int) -> Unit
write_char(Self, Char) -> Unit
}
Trait for a logger, where debug logs can be written into
Logger) -> Unit
Unit {
228 if Map[Errno, @string.StringView]
errno_messages.(self : Map[Errno, @string.StringView], key : Errno) -> @string.StringView?
Get the value associated with a key.
get(Errno
self) is (@string.StringView) -> @string.StringView?
Some(@string.StringView
message) {
229 &Logger
logger.(&Logger, String) -> Unit
write_string(@string.StringView
message.(self : @string.StringView) -> String
Returns a new String containing a copy of the characters in this view.
Examples
let str = "Hello World"
let view = str[0:5] // "Hello"
inspect(view.to_string(), content="Hello")
to_string())
230 return
231 }
232 let @string.StringView
message = (errno : Int) -> @string.StringView
strerror(Errno
self.(self : Errno) -> Int
to_int())
233 Map[Errno, @string.StringView]
errno_messages(Map[Errno, @string.StringView], Errno, @string.StringView) -> Unit
[self] = @string.StringView
message
234 &Logger
logger.(&Logger, String) -> Unit
write_string(@string.StringView
message.(self : @string.StringView) -> String
Returns a new String containing a copy of the characters in this view.
Examples
let str = "Hello World"
let view = str[0:5] // "Hello"
inspect(view.to_string(), content="Hello")
to_string())
235}
236
237///|
238extern "c" fn uv_E2BIG() -> Int
Int = "moonbit_uv_E2BIG"
239
240///|
241extern "c" fn uv_EACCES() -> Int
Int = "moonbit_uv_EACCES"
242
243///|
244extern "c" fn uv_EADDRINUSE() -> Int
Int = "moonbit_uv_EADDRINUSE"
245
246///|
247extern "c" fn uv_EADDRNOTAVAIL() -> Int
Int = "moonbit_uv_EADDRNOTAVAIL"
248
249///|
250extern "c" fn uv_EAFNOSUPPORT() -> Int
Int = "moonbit_uv_EAFNOSUPPORT"
251
252///|
253extern "c" fn uv_EAGAIN() -> Int
Int = "moonbit_uv_EAGAIN"
254
255///|
256extern "c" fn uv_EAI_ADDRFAMILY() -> Int
Int = "moonbit_uv_EAI_ADDRFAMILY"
257
258///|
259extern "c" fn uv_EAI_AGAIN() -> Int
Int = "moonbit_uv_EAI_AGAIN"
260
261///|
262extern "c" fn uv_EAI_BADFLAGS() -> Int
Int = "moonbit_uv_EAI_BADFLAGS"
263
264///|
265extern "c" fn uv_EAI_BADHINTS() -> Int
Int = "moonbit_uv_EAI_BADHINTS"
266
267///|
268extern "c" fn uv_EAI_CANCELED() -> Int
Int = "moonbit_uv_EAI_CANCELED"
269
270///|
271extern "c" fn uv_EAI_FAIL() -> Int
Int = "moonbit_uv_EAI_FAIL"
272
273///|
274extern "c" fn uv_EAI_FAMILY() -> Int
Int = "moonbit_uv_EAI_FAMILY"
275
276///|
277extern "c" fn uv_EAI_MEMORY() -> Int
Int = "moonbit_uv_EAI_MEMORY"
278
279///|
280extern "c" fn uv_EAI_NODATA() -> Int
Int = "moonbit_uv_EAI_NODATA"
281
282///|
283extern "c" fn uv_EAI_NONAME() -> Int
Int = "moonbit_uv_EAI_NONAME"
284
285///|
286extern "c" fn uv_EAI_OVERFLOW() -> Int
Int = "moonbit_uv_EAI_OVERFLOW"
287
288///|
289extern "c" fn uv_EAI_PROTOCOL() -> Int
Int = "moonbit_uv_EAI_PROTOCOL"
290
291///|
292extern "c" fn uv_EAI_SERVICE() -> Int
Int = "moonbit_uv_EAI_SERVICE"
293
294///|
295extern "c" fn uv_EAI_SOCKTYPE() -> Int
Int = "moonbit_uv_EAI_SOCKTYPE"
296
297///|
298extern "c" fn uv_EALREADY() -> Int
Int = "moonbit_uv_EALREADY"
299
300///|
301extern "c" fn uv_EBADF() -> Int
Int = "moonbit_uv_EBADF"
302
303///|
304extern "c" fn uv_EBUSY() -> Int
Int = "moonbit_uv_EBUSY"
305
306///|
307extern "c" fn uv_ECANCELED() -> Int
Int = "moonbit_uv_ECANCELED"
308
309///|
310extern "c" fn uv_ECHARSET() -> Int
Int = "moonbit_uv_ECHARSET"
311
312///|
313extern "c" fn uv_ECONNABORTED() -> Int
Int = "moonbit_uv_ECONNABORTED"
314
315///|
316extern "c" fn uv_ECONNREFUSED() -> Int
Int = "moonbit_uv_ECONNREFUSED"
317
318///|
319extern "c" fn uv_ECONNRESET() -> Int
Int = "moonbit_uv_ECONNRESET"
320
321///|
322extern "c" fn uv_EDESTADDRREQ() -> Int
Int = "moonbit_uv_EDESTADDRREQ"
323
324///|
325extern "c" fn uv_EEXIST() -> Int
Int = "moonbit_uv_EEXIST"
326
327///|
328extern "c" fn uv_EFAULT() -> Int
Int = "moonbit_uv_EFAULT"
329
330///|
331extern "c" fn uv_EFBIG() -> Int
Int = "moonbit_uv_EFBIG"
332
333///|
334extern "c" fn uv_EHOSTUNREACH() -> Int
Int = "moonbit_uv_EHOSTUNREACH"
335
336///|
337extern "c" fn uv_EINTR() -> Int
Int = "moonbit_uv_EINTR"
338
339///|
340extern "c" fn uv_EINVAL() -> Int
Int = "moonbit_uv_EINVAL"
341
342///|
343extern "c" fn uv_EIO() -> Int
Int = "moonbit_uv_EIO"
344
345///|
346extern "c" fn uv_EISCONN() -> Int
Int = "moonbit_uv_EISCONN"
347
348///|
349extern "c" fn uv_EISDIR() -> Int
Int = "moonbit_uv_EISDIR"
350
351///|
352extern "c" fn uv_ELOOP() -> Int
Int = "moonbit_uv_ELOOP"
353
354///|
355extern "c" fn uv_EMFILE() -> Int
Int = "moonbit_uv_EMFILE"
356
357///|
358extern "c" fn uv_EMSGSIZE() -> Int
Int = "moonbit_uv_EMSGSIZE"
359
360///|
361extern "c" fn uv_ENAMETOOLONG() -> Int
Int = "moonbit_uv_ENAMETOOLONG"
362
363///|
364extern "c" fn uv_ENETDOWN() -> Int
Int = "moonbit_uv_ENETDOWN"
365
366///|
367extern "c" fn uv_ENETUNREACH() -> Int
Int = "moonbit_uv_ENETUNREACH"
368
369///|
370extern "c" fn uv_ENFILE() -> Int
Int = "moonbit_uv_ENFILE"
371
372///|
373extern "c" fn uv_ENOBUFS() -> Int
Int = "moonbit_uv_ENOBUFS"
374
375///|
376extern "c" fn uv_ENODEV() -> Int
Int = "moonbit_uv_ENODEV"
377
378///|
379extern "c" fn uv_ENOENT() -> Int
Int = "moonbit_uv_ENOENT"
380
381///|
382extern "c" fn uv_ENOMEM() -> Int
Int = "moonbit_uv_ENOMEM"
383
384///|
385extern "c" fn uv_ENONET() -> Int
Int = "moonbit_uv_ENONET"
386
387///|
388extern "c" fn uv_ENOPROTOOPT() -> Int
Int = "moonbit_uv_ENOPROTOOPT"
389
390///|
391extern "c" fn uv_ENOSPC() -> Int
Int = "moonbit_uv_ENOSPC"
392
393///|
394extern "c" fn uv_ENOSYS() -> Int
Int = "moonbit_uv_ENOSYS"
395
396///|
397extern "c" fn uv_ENOTCONN() -> Int
Int = "moonbit_uv_ENOTCONN"
398
399///|
400extern "c" fn uv_ENOTDIR() -> Int
Int = "moonbit_uv_ENOTDIR"
401
402///|
403extern "c" fn uv_ENOTEMPTY() -> Int
Int = "moonbit_uv_ENOTEMPTY"
404
405///|
406extern "c" fn uv_ENOTSOCK() -> Int
Int = "moonbit_uv_ENOTSOCK"
407
408///|
409extern "c" fn uv_ENOTSUP() -> Int
Int = "moonbit_uv_ENOTSUP"
410
411///|
412extern "c" fn uv_EOVERFLOW() -> Int
Int = "moonbit_uv_EOVERFLOW"
413
414///|
415extern "c" fn uv_EPERM() -> Int
Int = "moonbit_uv_EPERM"
416
417///|
418extern "c" fn uv_EPIPE() -> Int
Int = "moonbit_uv_EPIPE"
419
420///|
421extern "c" fn uv_EPROTO() -> Int
Int = "moonbit_uv_EPROTO"
422
423///|
424extern "c" fn uv_EPROTONOSUPPORT() -> Int
Int = "moonbit_uv_EPROTONOSUPPORT"
425
426///|
427extern "c" fn uv_EPROTOTYPE() -> Int
Int = "moonbit_uv_EPROTOTYPE"
428
429///|
430extern "c" fn uv_ERANGE() -> Int
Int = "moonbit_uv_ERANGE"
431
432///|
433extern "c" fn uv_EROFS() -> Int
Int = "moonbit_uv_EROFS"
434
435///|
436extern "c" fn uv_ESHUTDOWN() -> Int
Int = "moonbit_uv_ESHUTDOWN"
437
438///|
439extern "c" fn uv_ESPIPE() -> Int
Int = "moonbit_uv_ESPIPE"
440
441///|
442extern "c" fn uv_ESRCH() -> Int
Int = "moonbit_uv_ESRCH"
443
444///|
445extern "c" fn uv_ETIMEDOUT() -> Int
Int = "moonbit_uv_ETIMEDOUT"
446
447///|
448extern "c" fn uv_ETXTBSY() -> Int
Int = "moonbit_uv_ETXTBSY"
449
450///|
451extern "c" fn uv_EXDEV() -> Int
Int = "moonbit_uv_EXDEV"
452
453///|
454extern "c" fn uv_UNKNOWN() -> Int
Int = "moonbit_uv_UNKNOWN"
455
456///|
457extern "c" fn uv_EOF() -> Int
Int = "moonbit_uv_EOF"
458
459///|
460extern "c" fn uv_ENXIO() -> Int
Int = "moonbit_uv_ENXIO"
461
462///|
463extern "c" fn uv_EMLINK() -> Int
Int = "moonbit_uv_EMLINK"
464
465///|
466extern "c" fn uv_EHOSTDOWN() -> Int
Int = "moonbit_uv_EHOSTDOWN"
467
468///|
469extern "c" fn uv_EREMOTEIO() -> Int
Int = "moonbit_uv_EREMOTEIO"
470
471///|
472extern "c" fn uv_ENOTTY() -> Int
Int = "moonbit_uv_ENOTTY"
473
474///|
475extern "c" fn uv_EFTYPE() -> Int
Int = "moonbit_uv_EFTYPE"
476
477///|
478extern "c" fn uv_EILSEQ() -> Int
Int = "moonbit_uv_EILSEQ"
479
480///|
481extern "c" fn uv_ESOCKTNOSUPPORT() -> Int
Int = "moonbit_uv_ESOCKTNOSUPPORT"
482
483///|
484extern "c" fn uv_ENODATA() -> Int
Int = "moonbit_uv_ENODATA"
485
486///|
487extern "c" fn uv_EUNATCH() -> Int
Int = "moonbit_uv_EUNATCH"
488
489///|
490extern "c" fn uv_ENOEXEC() -> Int
Int = "moonbit_uv_ENOEXEC"
491