tezvyn:

Network read/write timeouts in Go vs Rust stdlib

Source: interviewadvanced

WHAT IT TESTS: stdlib IO timeout APIs and design philosophy. OUTLINE: Go uses SetReadDeadline/SetWriteDeadline as absolute times; Rust uses set_read_timeout/set_write_timeout as durations on TcpStream.

WHAT IT TESTS: knowledge of concrete timeout APIs and what they reveal about each language. ANSWER OUTLINE: Go's net.Conn exposes SetDeadline, SetReadDeadline, SetWriteDeadline taking an absolute time.Time; a past or zero value clears it, and exceeding it yields a timeout error. Rust's TcpStream offers set_read_timeout and set_write_timeout taking Option<Duration>, relative spans. Go favors deadlines that compose with context; Rust favors explicit per-operation durations.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Network read/write timeouts in Go vs Rust stdlib · Tezvyn