bind

Function bind 

Source
pub async fn bind(addr: SocketAddr) -> Result<TcpListener>
Expand description

Bind the read-model port, refusing anything but loopback.

There is no authentication here — see the module docs — and this bound is what stands in for one: a port that answers every question about an application’s state belongs on the same host as the process, reached by whatever forwards it there.

Separate from serve so a caller can fail the command rather than a background task: an address this process will not serve on should be an error the person who typed it sees.