pub struct Server { /* private fields */ }Expand description
SSH server for hosting applications.
Implementations§
Source§impl Server
impl Server
Sourcepub fn new(options: impl IntoIterator<Item = ServerOption>) -> Result<Self>
pub fn new(options: impl IntoIterator<Item = ServerOption>) -> Result<Self>
Creates a new server with the given options.
Sourcepub fn options(&self) -> &ServerOptions
pub fn options(&self) -> &ServerOptions
Returns the server options.
Sourcepub async fn listen(&self) -> Result<()>
pub async fn listen(&self) -> Result<()>
Starts listening for connections.
This binds to the configured address, accepts SSH connections, and runs the handler for each connection.
Sourcepub async fn listen_with_listener(&self, listener: TcpListener) -> Result<()>
pub async fn listen_with_listener(&self, listener: TcpListener) -> Result<()>
Starts listening for connections using an already-bound listener.
This is primarily useful for tests and embedding scenarios where you need to
bind to an ephemeral port (127.0.0.1:0) without races.
Sourcepub async fn listen_and_serve(&self) -> Result<()>
pub async fn listen_and_serve(&self) -> Result<()>
Starts listening and handles shutdown gracefully.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more