2 ms·
If the socket is already in use the .bind call will fail to unwrap() and the program will panic and exit. It's generally considered bad form to use unwrap() (a
by leshow 10y ago
If the socket is already in use the .bind call will fail to unwrap() and the program will panic and exit.
It's generally considered bad form to use unwrap() (and by extension panic) in production code, but for examples where you just want to show something it's fine.
bind would either return a Option type or a Result type, unwrap is defined for both.
edit: Others have looked through the docs and confirmed it's a Result