28 ms·
This code does not handle the situation - the program will crash. TcpListener::bind(&addr, &handle).unwrap() Rather than raising exceptions, the paradigm in R
by yammajr 10y ago
This code does not handle the situation - the program will crash.
TcpListener::bind(&addr, &handle).unwrap()
Rather than raising exceptions, the paradigm in Rust is to return a Response item, which has an Ok and an Err subtype. unwrap() here assumes that the response is Ok and just gives that back the data returned, or crashes if its an error.
- eridius 10y agoNitpick: The program will print an error and abort. It won't crash. It's a "clean" shutdown.
- steveklabnik 10y agoNiptick on your nitpick: it will call the panic hook, then call into the panic runtime, which may unwind the stack or abort. > It won't crash. It's a "clean" shutdown. :+1: