Skip to main content

rl_lang/docs/entries/stdlib/net/
tcp_connect.rs

1use crate::docs::entry::FnEntry;
2
3pub static TCP_CONNECT: FnEntry = FnEntry {
4    signature: "tcp_connect(addr)",
5    description: "connects to \"host:port\" as a client and returns a stream handle",
6    example: r#"
7get std::net::tcp_connect
8
9dec int stream = result_unwrap(tcp_connect("example.com:80"))"#,
10    expected_output: None,
11    returns: "Result[int]",
12    errors: Some("Err(string) when the connection fails (refused, timed out, unresolved host)"),
13    see_also: &["tcp_read", "tcp_write", "resolve"],
14    since: Some("v0.1.5"),
15};