INNER CODE UNIT · Rust
new
ekzhang/sshx · crates/sshx-server/src/lib.rs:57
pub fn new(options: ServerOptions) -> Result<Self> {
Ok(Self {
state: Arc::new(ServerState::new(options)?),
shutdown: Shutdown::new(),
})
}
/// Returns the server's state object.
pub fn state(&self) -> Arc<ServerState> {
Arc::clone(&self.state)
}
/// Run the application server, listening on a stream of connections.
pub async fn listen<L>(&self, listener: L) -> Result<()>
where
L: Listener,
L::Addr: Debug,
{