pub struct HttpServer { /* private fields */ }Expand description
A bound HTTP/1.1 server listener.
Implementations§
Source§impl HttpServer
impl HttpServer
Sourcepub async fn bind(addr: &str, config: ServerConfig) -> Result<Self>
pub async fn bind(addr: &str, config: ServerConfig) -> Result<Self>
Bind a one-shot HTTP server to the first address resolved from addr.
§Errors
Returns invalid configuration, address resolution, or socket-bind failures.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Return the local address assigned to the listener.
§Errors
Propagates the underlying socket query failure.
Sourcepub async fn accept(&self) -> Result<HttpConnection<AwaitingRequest>>
pub async fn accept(&self) -> Result<HttpConnection<AwaitingRequest>>
Accept one connection and enter the request-reading typestate.
§Errors
Returns connection-pool exhaustion or an accept failure.
Auto Trait Implementations§
impl Freeze for HttpServer
impl RefUnwindSafe for HttpServer
impl Send for HttpServer
impl Sync for HttpServer
impl Unpin for HttpServer
impl UnsafeUnpin for HttpServer
impl UnwindSafe for HttpServer
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