2 ms·
The example code does not handle a failure in that situation. The TCPListener::bind call returns a Result enum, which can have the values Ok(SomeType) or Err(S
by Crespyl 10y ago
The example code does not handle a failure in that situation.
The TCPListener::bind call returns a Result enum, which can have the values Ok(SomeType) or Err(SomeError). The compiler forces you to decide how you want to handle that, for the sake of brevity the example code calls unwrap() which assumes the result is Ok and will either return SomeType or else panic.