slovo/lib/std/net.slo

37 lines
1.2 KiB
Plaintext

(module net (export tcp_connect_loopback_result tcp_listen_loopback_result tcp_bound_port_result tcp_accept_result tcp_read_all_result tcp_write_text_result tcp_close_result tcp_write_text_ok tcp_close_ok))
(fn tcp_connect_loopback_result ((port i32)) -> (result i32 i32)
(std.net.tcp_connect_loopback_result port))
(fn tcp_listen_loopback_result ((port i32)) -> (result i32 i32)
(std.net.tcp_listen_loopback_result port))
(fn tcp_bound_port_result ((handle i32)) -> (result i32 i32)
(std.net.tcp_bound_port_result handle))
(fn tcp_accept_result ((listener i32)) -> (result i32 i32)
(std.net.tcp_accept_result listener))
(fn tcp_read_all_result ((handle i32)) -> (result string i32)
(std.net.tcp_read_all_result handle))
(fn tcp_write_text_result ((handle i32) (text string)) -> (result i32 i32)
(std.net.tcp_write_text_result handle text))
(fn tcp_close_result ((handle i32)) -> (result i32 i32)
(std.net.tcp_close_result handle))
(fn tcp_write_text_ok ((handle i32) (text string)) -> bool
(match (tcp_write_text_result handle text)
((ok status)
true)
((err code)
false)))
(fn tcp_close_ok ((handle i32)) -> bool
(match (tcp_close_result handle)
((ok status)
true)
((err code)
false)))