Skip to main content

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

1use crate::docs::entry::FnEntry;
2
3pub static TCP_READ: FnEntry = FnEntry {
4    signature: "tcp_read(stream, max_bytes)",
5    description: "reads up to `max_bytes` from a TCP stream; blocks until at least some data arrives unless a timeout/nonblocking mode is set",
6    example: r#"
7get std::net::tcp_read
8
9dec string data = result_unwrap(tcp_read(stream, 1024))"#,
10    expected_output: None,
11    returns: "Result[string]",
12    errors: Some("Err(string) on a read error"),
13    see_also: &["tcp_write", "tcp_set_timeout", "tcp_set_nonblocking"],
14    since: Some("v0.1.5"),
15};