pub struct Server<A> { /* private fields */ }Expand description
HTTP Server.
A Server is created to listen on a port, parse HTTP requests, and hand them off to a Service.
Implementations§
Source§impl<A> Server<A>
impl<A> Server<A>
Sourcepub fn with_http_builder(acceptor: A, builder: HttpBuilder) -> Server<A>
pub fn with_http_builder(acceptor: A, builder: HttpBuilder) -> Server<A>
Create new Server with Acceptor and [HttpBuilder].
Sourcepub fn fuse_factory<F>(self, factory: F) -> Server<A>
pub fn fuse_factory<F>(self, factory: F) -> Server<A>
Set the fuse factory.
Sourcepub fn handle(&self) -> ServerHandle
pub fn handle(&self) -> ServerHandle
Get a ServerHandle to stop server.
Sourcepub fn stop_forcible(&self)
pub fn stop_forcible(&self)
Force stop server.
Call this function will stop server immediately.
Sourcepub fn stop_graceful(&self, timeout: impl Into<Option<Duration>>)
pub fn stop_graceful(&self, timeout: impl Into<Option<Duration>>)
Graceful stop server.
Call this function will stop server after all connections are closed.
You can specify a timeout to force stop server.
If timeout is None, it will wait until all connections are closed.
Sourcepub fn http2_mut(&mut self) -> &mut Builder<TokioExecutor>
pub fn http2_mut(&mut self) -> &mut Builder<TokioExecutor>
Use this function to set http2 protocol.
Auto Trait Implementations§
impl<A> Freeze for Server<A>where
A: Freeze,
impl<A> !RefUnwindSafe for Server<A>
impl<A> Send for Server<A>where
A: Send,
impl<A> Sync for Server<A>where
A: Sync,
impl<A> Unpin for Server<A>where
A: Unpin,
impl<A> !UnwindSafe for Server<A>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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