1// Copyright 2025 International Digital Economy Academy
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15///|
16type GetAddrInfo
17
18///|
19extern "c" fn uv_getaddrinfo_make() -> type GetAddrInfo
GetAddrInfo = "moonbit_uv_getaddrinfo_make"
20
21///|
22type AddrInfoHints
23
24///|
25extern "c" fn uv_addrinfo_hints(
26 flags : Int
Int,
27 family : Int
Int,
28 socktype : Int
Int,
29 protocol : Int
Int
30) -> type AddrInfoHints
AddrInfoHints = "moonbit_uv_addrinfo_hints"
31
32///|
33type AddrInfoFlags Int
Int
34
35///|
36extern "c" fn uv_AI_PASSIVE() -> Int
Int = "moonbit_uv_AI_PASSIVE"
37
38///|
39let Int
_AI_PASSIVE : Int
Int = () -> Int
uv_AI_PASSIVE()
40
41///|
42extern "c" fn uv_AI_CANONNAME() -> Int
Int = "moonbit_uv_AI_CANONNAME"
43
44///|
45let Int
_AI_CANONNAME : Int
Int = () -> Int
uv_AI_CANONNAME()
46
47///|
48extern "c" fn uv_AI_NUMERICHOST() -> Int
Int = "moonbit_uv_AI_NUMERICHOST"
49
50///|
51let Int
_AI_NUMERICHOST : Int
Int = () -> Int
uv_AI_NUMERICHOST()
52
53///|
54extern "c" fn uv_AI_NUMERICSERV() -> Int
Int = "moonbit_uv_AI_NUMERICSERV"
55
56///|
57let Int
_AI_NUMERICSERV : Int
Int = () -> Int
uv_AI_NUMERICSERV()
58
59///|
60extern "c" fn uv_AI_ALL() -> Int
Int = "moonbit_uv_AI_ALL"
61
62///|
63let Int
_AI_ALL : Int
Int = () -> Int
uv_AI_ALL()
64
65///|
66extern "c" fn uv_AI_ADDRCONFIG() -> Int
Int = "moonbit_uv_AI_ADDRCONFIG"
67
68///|
69let Int
_AI_ADDRCONFIG : Int
Int = () -> Int
uv_AI_ADDRCONFIG()
70
71///|
72extern "c" fn uv_AI_V4MAPPED() -> Int
Int = "moonbit_uv_AI_V4MAPPED"
73
74///|
75let Int
_AI_V4MAPPED : Int
Int = () -> Int
uv_AI_V4MAPPED()
76
77///|
78pub fn type AddrInfoFlags Int
AddrInfoFlags::(passive~ : Bool = .., canonname~ : Bool = .., numeric_host~ : Bool = .., numeric_serv~ : Bool = .., all~ : Bool = .., addrconfig~ : Bool = .., v4mapped~ : Bool = ..) -> AddrInfoFlags
new(
79 Bool
passive~ : Bool
Bool = false,
80 Bool
canonname~ : Bool
Bool = false,
81 Bool
numeric_host~ : Bool
Bool = false,
82 Bool
numeric_serv~ : Bool
Bool = false,
83 Bool
all~ : Bool
Bool = false,
84 Bool
addrconfig~ : Bool
Bool = false,
85 Bool
v4mapped~ : Bool
Bool = false
86) -> type AddrInfoFlags Int
AddrInfoFlags {
87 let mut Int
flags = 0
88 if Bool
passive {
89 Int
flags = Int
flags (Int, Int) -> Int
| Int
_AI_PASSIVE
90 }
91 if Bool
canonname {
92 Int
flags = Int
flags (Int, Int) -> Int
| Int
_AI_CANONNAME
93 }
94 if Bool
numeric_host {
95 Int
flags = Int
flags (Int, Int) -> Int
| Int
_AI_NUMERICHOST
96 }
97 if Bool
numeric_serv {
98 Int
flags = Int
flags (Int, Int) -> Int
| Int
_AI_NUMERICSERV
99 }
100 if Bool
all {
101 Int
flags = Int
flags (Int, Int) -> Int
| Int
_AI_ALL
102 }
103 if Bool
addrconfig {
104 Int
flags = Int
flags (Int, Int) -> Int
| Int
_AI_ADDRCONFIG
105 }
106 if Bool
v4mapped {
107 Int
flags = Int
flags (Int, Int) -> Int
| Int
_AI_V4MAPPED
108 }
109 return Int
flags
110}
111
112///|
113pub fn type AddrInfoHints
AddrInfoHints::(flags? : AddrInfoFlags, family? : AddressFamily, socktype? : SockType, protocol? : Protocol) -> AddrInfoHints
new(
114 AddrInfoFlags?
flags? : type AddrInfoFlags Int
AddrInfoFlags,
115 AddressFamily?
family? : enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily,
116 SockType?
socktype? : enum SockType {
Stream
Raw
Datagram
}
SockType,
117 Protocol?
protocol? : enum Protocol {
Tcp
Udp
}
Protocol
118) -> type AddrInfoHints
AddrInfoHints {
119 let Int
flags = match AddrInfoFlags?
flags {
120 (AddrInfoFlags) -> AddrInfoFlags?
Some(AddrInfoFlags
flags) => AddrInfoFlags
flags.(self : AddrInfoFlags) -> Int
Convert newtype to its underlying type, automatically derived.
inner()
121 AddrInfoFlags?
None => 0
122 }
123 let Int
family = match AddressFamily?
family {
124 (AddressFamily) -> AddressFamily?
Some(AddressFamily
family) => AddressFamily
family.(self : AddressFamily) -> Int
to_int()
125 AddressFamily?
None => Int
_AF_UNSPEC
126 }
127 let Int
socktype = match SockType?
socktype {
128 (SockType) -> SockType?
Some(SockType
socktype) => SockType
socktype.(self : SockType) -> Int
to_int()
129 SockType?
None => 0
130 }
131 let Int
protocol = match Protocol?
protocol {
132 (Protocol) -> Protocol?
Some(Protocol
protocol) => Protocol
protocol.(self : Protocol) -> Int
to_int()
133 Protocol?
None => 0
134 }
135 (flags : Int, family : Int, socktype : Int, protocol : Int) -> AddrInfoHints
uv_addrinfo_hints(Int
flags, Int
family, Int
socktype, Int
protocol)
136}
137
138///|
139extern "c" fn type AddrInfoHints
AddrInfoHints::nil() -> type AddrInfoHints
AddrInfoHints = "moonbit_c_null"
140
141///|
142priv type AddrInfoResults
143
144///|
145#borrow(addrinfo_results, cb)
146extern "c" fn uv_addrinfo_results_iterate(
147 addrinfo_results : type AddrInfoResults
AddrInfoResults,
148 cb : (Int
Int, Int
Int, Int
Int, Int
Int, type Sockaddr Bytes
Sockaddr, type @c.Pointer[_]
@c.Pointer[Byte
Byte]) -> Bool
Bool
149) -> Bool
Bool = "moonbit_uv_addrinfo_results_iterate"
150
151///|
152extern "c" fn uv_IF_NAMESIZE() -> Int
Int = "moonbit_uv_IF_NAMESIZE"
153
154///|
155let Int
_IF_NAMESIZE : Int
Int = () -> Int
uv_IF_NAMESIZE()
156
157///|
158struct AddrInfo {
159 Int
family : Int
Int
160 Int
socktype : Int
Int
161 Int
protocol : Int
Int
162 Sockaddr
addr : type Sockaddr Bytes
Sockaddr
163 String?
canonname : String
String?
164}
165
166///|
167extern "c" fn uv_AF_INET() -> Int
Int = "moonbit_uv_AF_INET"
168
169///|
170let Int
_AF_INET : Int
Int = () -> Int
uv_AF_INET()
171
172///|
173extern "c" fn uv_AF_INET6() -> Int
Int = "moonbit_uv_AF_INET6"
174
175///|
176let Int
_AF_INET6 : Int
Int = () -> Int
uv_AF_INET6()
177
178///|
179extern "c" fn uv_AF_UNSPEC() -> Int
Int = "moonbit_uv_AF_UNSPEC"
180
181///|
182let Int
_AF_UNSPEC : Int
Int = () -> Int
uv_AF_UNSPEC()
183
184///|
185/// Represents the address family for network communication, specifying the
186/// format of network addresses.
187///
188/// Constructors:
189///
190/// * `Inet` : IPv4 address family
191/// * `Inet6` : IPv6 address family
192///
193/// Example:
194///
195/// ```moonbit
196/// let ipv4 = AddressFamily::inet()
197/// let ipv6 = AddressFamily::inet6()
198/// inspect(ipv4, content="Inet")
199/// inspect(ipv6, content="Inet6")
200/// ```
201pub enum AddressFamily {
202 AddressFamily
Inet
203 AddressFamily
Inet6
204} derive(trait Show {
output(Self, &Logger) -> Unit
to_string(Self) -> String
}
Trait for types that can be converted to String
Show)
205
206///|
207pub fn enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily::() -> AddressFamily
inet() -> enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily {
208 return AddressFamily
Inet
209}
210
211///|
212pub fn enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily::() -> AddressFamily
inet6() -> enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily {
213 return AddressFamily
Inet6
214}
215
216///|
217fn enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily::(self : Int) -> AddressFamily raise Errno
of_int(Int
self : Int
Int) -> enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily raise type! Errno Status
Errno {
218 if Int
self (self : Int, other : Int) -> Bool
Compares two integers for equality.
Parameters:
self : The first integer to compare.
other : The second integer to compare.
Returns true if both integers have the same value, false otherwise.
Example:
inspect(42 == 42, content="true")
inspect(42 == -42, content="false")
== Int
_AF_INET {
219 return AddressFamily
Inet
220 }
221 if Int
self (self : Int, other : Int) -> Bool
Compares two integers for equality.
Parameters:
self : The first integer to compare.
other : The second integer to compare.
Returns true if both integers have the same value, false otherwise.
Example:
inspect(42 == 42, content="true")
inspect(42 == -42, content="false")
== Int
_AF_INET6 {
222 return AddressFamily
Inet6
223 }
224 raise (Status) -> Errno
Errno(Status
EINVAL)
225}
226
227///|
228fn enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily::(self : AddressFamily) -> Int
to_int(AddressFamily
self : enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily) -> Int
Int {
229 match AddressFamily
self {
230 AddressFamily
Inet => Int
_AF_INET
231 AddressFamily
Inet6 => Int
_AF_INET6
232 }
233}
234
235///|
236pub fn struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo::(self : AddrInfo) -> AddressFamily raise Errno
family(AddrInfo
self : struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo) -> enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily raise type! Errno Status
Errno {
237 enum AddressFamily {
Inet
Inet6
}
Represents the address family for network communication, specifying the
format of network addresses.
Constructors:
Inet : IPv4 address family
Inet6 : IPv6 address family
Example:
let ipv4 = AddressFamily::inet()
let ipv6 = AddressFamily::inet6()
inspect(ipv4, content="Inet")
inspect(ipv6, content="Inet6")
AddressFamily::(self : Int) -> AddressFamily raise Errno
of_int(AddrInfo
self.Int
family)
238}
239
240///|
241pub fn struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo::(self : AddrInfo) -> Sockaddr
addr(AddrInfo
self : struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo) -> type Sockaddr Bytes
Sockaddr {
242 AddrInfo
self.Sockaddr
addr
243}
244
245///|
246pub fn struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo::(self : AddrInfo) -> SockType raise Errno
socktype(AddrInfo
self : struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo) -> enum SockType {
Stream
Raw
Datagram
}
SockType raise type! Errno Status
Errno {
247 return enum SockType {
Stream
Raw
Datagram
}
SockType::(self : Int) -> SockType raise Errno
of_int(AddrInfo
self.Int
socktype)
248}
249
250///|
251pub fn struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo::(self : AddrInfo) -> Protocol raise Errno
protocol(AddrInfo
self : struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo) -> enum Protocol {
Tcp
Udp
}
Protocol raise type! Errno Status
Errno {
252 enum Protocol {
Tcp
Udp
}
Protocol::(self : Int) -> Protocol raise Errno
of_int(AddrInfo
self.Int
protocol)
253}
254
255///|
256pub fn struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo::(self : AddrInfo) -> String?
canonname(AddrInfo
self : struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo) -> String
String? {
257 AddrInfo
self.String?
canonname
258}
259
260///|
261fn type AddrInfoResults
AddrInfoResults::(self : AddrInfoResults) -> Iter[AddrInfo]
iter(AddrInfoResults
self : type AddrInfoResults
AddrInfoResults) -> type Iter[T]
Iter[struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo] {
262 type Iter[T]
Iter::(((AddrInfo) -> IterResult) -> IterResult) -> Iter[AddrInfo]
Do not use this method, it is for internal use only.
new(fn((AddrInfo) -> IterResult
yield_) {
263 if (addrinfo_results : AddrInfoResults, cb : (Int, Int, Int, Int, Sockaddr, @c.Pointer[Byte]) -> Bool) -> Bool
uv_addrinfo_results_iterate(AddrInfoResults
self, fn(
264 _,
265 Int
family,
266 Int
socktype,
267 Int
protocol,
268 Sockaddr
addr,
269 @c.Pointer[Byte]
canonname
270 ) {
271 let String?
canonname = if @c.Pointer[Byte]
canonname.(self : @c.Pointer[Byte]) -> Bool
is_null() {
272 String?
None
273 } else {
274 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:
let buf = @buffer.new(size_hint=10)
inspect(buf.length(), content="0")
buf.write_string("test")
inspect(buf.length(), content="8")
@buffer.new()
275 for Int
i = 0; @c.Pointer[Byte]
canonname(@c.Pointer[Byte], Int) -> Byte
[i] (x : Byte, y : Byte) -> Bool
!= 0; Int
i = Int
i (self : Int, other : Int) -> Int
Adds two 32-bit signed integers. Performs two's complement arithmetic, which
means the operation will wrap around if the result exceeds the range of a
32-bit integer.
Parameters:
self : The first integer operand.
other : The second integer operand.
Returns a new integer that is the sum of the two operands. If the
mathematical sum exceeds the range of a 32-bit integer (-2,147,483,648 to
2,147,483,647), the result wraps around according to two's complement rules.
Example:
inspect(42 + 1, content="43")
inspect(2147483647 + 1, content="-2147483648") // Overflow wraps around to minimum value
+ 1 {
276 @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:
let buf = @buffer.new()
buf.write_byte(b'\x41')
inspect(buf.contents(), content="b\"\\x41\"")
write_byte(@c.Pointer[Byte]
canonname(@c.Pointer[Byte], Int) -> Byte
[i])
277 }
278 (String) -> String?
Some((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 content as a sequence of bytes.
Parameters:
buffer : The buffer to read from.
Returns a Bytes object containing all bytes written to the buffer.
Example:
let buf = @buffer.new()
buf.write_string("Test")
inspect(
buf.contents(),
content=
#|b"\x54\x00\x65\x00\x73\x00\x74\x00"
,
)
contents()))
279 }
280 match (AddrInfo) -> IterResult
yield_({ Int
family, Int
socktype, Int
protocol, Sockaddr
addr, String?
canonname }) {
281 IterResult
IterEnd => true
282 IterResult
IterContinue => false
283 }
284 }) {
285 return IterResult
IterEnd
286 } else {
287 return IterResult
IterContinue
288 }
289 })
290}
291
292///|
293extern "c" fn uv_getaddrinfo(
294 uv : type Loop Bytes
Loop,
295 req : type GetAddrInfo
GetAddrInfo,
296 getaddrinfo_cb : (type GetAddrInfo
GetAddrInfo, Int
Int, type AddrInfoResults
AddrInfoResults) -> Unit
Unit,
297 node : Bytes
Bytes,
298 service : Bytes
Bytes,
299 hints : type AddrInfoHints
AddrInfoHints
300) -> Int
Int = "moonbit_uv_getaddrinfo"
301
302///|
303pub fn[Node : trait ToNtbs {
to_ntbs(Self) -> Bytes
}
Convertible to null-terminated byte strings (NTBS).
ToNtbs, Service : trait ToNtbs {
to_ntbs(Self) -> Bytes
}
Convertible to null-terminated byte strings (NTBS).
ToNtbs] type Loop Bytes
Loop::(self : Loop, getaddrinfo_cb : (GetAddrInfo, Iter[AddrInfo]) -> Unit, error_cb : (GetAddrInfo, Errno) -> Unit, node : Node, service : Service, hints? : AddrInfoHints) -> Unit raise Errno
getaddrinfo(
304 Loop
self : type Loop Bytes
Loop,
305 (GetAddrInfo, Iter[AddrInfo]) -> Unit
getaddrinfo_cb : (type GetAddrInfo
GetAddrInfo, type Iter[T]
Iter[struct AddrInfo {
family: Int
socktype: Int
protocol: Int
addr: Sockaddr
canonname: String?
}
AddrInfo]) -> Unit
Unit,
306 (GetAddrInfo, Errno) -> Unit
error_cb : (type GetAddrInfo
GetAddrInfo, type! Errno Status
Errno) -> Unit
Unit,
307 Node
node : type parameter Node
Node,
308 Service
service : type parameter Service
Service,
309 AddrInfoHints?
hints? : type AddrInfoHints
AddrInfoHints
310) -> Unit
Unit raise type! Errno Status
Errno {
311 fn (GetAddrInfo, Int, AddrInfoResults) -> Unit
uv_cb(GetAddrInfo
req : type GetAddrInfo
GetAddrInfo, Int
status : Int
Int, AddrInfoResults
addrinfo : type AddrInfoResults
AddrInfoResults) {
312 if Int
status (self_ : Int, other : Int) -> Bool
< 0 {
313 (GetAddrInfo, Errno) -> Unit
error_cb(GetAddrInfo
req, type! Errno Status
Errno::(errno : Int) -> Errno
of_int(Int
status))
314 } else {
315 (GetAddrInfo, Iter[AddrInfo]) -> Unit
getaddrinfo_cb(GetAddrInfo
req, AddrInfoResults
addrinfo.(self : AddrInfoResults) -> Iter[AddrInfo]
iter())
316 }
317 }
318
319 let GetAddrInfo
req = () -> GetAddrInfo
uv_getaddrinfo_make()
320 let Int
status = (uv : Loop, req : GetAddrInfo, getaddrinfo_cb : (GetAddrInfo, Int, AddrInfoResults) -> Unit, node : Bytes, service : Bytes, hints : AddrInfoHints) -> Int
uv_getaddrinfo(
321 Loop
self,
322 GetAddrInfo
req,
323 (GetAddrInfo, Int, AddrInfoResults) -> Unit
uv_cb,
324 Node
node.(Node) -> Bytes
to_ntbs(),
325 Service
service.(Service) -> Bytes
to_ntbs(),
326 AddrInfoHints?
hints.(self : AddrInfoHints?, default : () -> AddrInfoHints) -> AddrInfoHints
Return the contained Some value or the provided default.
Default is lazily evaluated
or_else(type AddrInfoHints
AddrInfoHints() -> AddrInfoHints
::nil),
327 )
328 if Int
status (self_ : Int, other : Int) -> Bool
< 0 {
329 raise type! Errno Status
Errno::(errno : Int) -> Errno
of_int(Int
status)
330 }
331}
332