pub struct Server {
pub address: String,
pub listener: StreamListener,
}
Expand description
Represents a server! Get ready for all those new connections
Fields§
§address: String
The address being listened to
listener: StreamListener
Provides access to the underlying stream, so you can work beyond the simple abstraction
Implementations§
Source§impl Server
impl Server
Sourcepub async fn listen<T>(
address: T,
cert_and_key: Option<CertAndKeyFilePaths>,
) -> Result<Server>where
T: ToString,
pub async fn listen<T>(
address: T,
cert_and_key: Option<CertAndKeyFilePaths>,
) -> Result<Server>where
T: ToString,
Create a new server, will be listening and ready to go!
If a cert_and_key
is provided, TLS will be used
If address begins with unix://, Unix socket will be used
Otherwise, TCP socket type will be assumed
Sourcepub async fn accept(&mut self) -> Result<StreamClient>
pub async fn accept(&mut self) -> Result<StreamClient>
Accept connection from a new client
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