pub struct Server<L, A> { /* private fields */ }
Available on crate feature
server
only.Expand description
An HTTP Server.
Implementations
sourceimpl<L: Listener> Server<L, Infallible>
impl<L: Listener> Server<L, Infallible>
sourceimpl<A: Acceptor> Server<Infallible, A>
impl<A: Acceptor> Server<Infallible, A>
sourcepub fn new_with_acceptor(acceptor: A) -> Self
pub fn new_with_acceptor(acceptor: A) -> Self
Use the specified acceptor to create an HTTP server.
sourceimpl<L, A> Server<L, A>where
L: Listener,
L::Acceptor: 'static,
A: Acceptor + 'static,
impl<L, A> Server<L, A>where
L: Listener,
L::Acceptor: 'static,
A: Acceptor + 'static,
sourcepub fn name(self, name: impl Into<String>) -> Self
pub fn name(self, name: impl Into<String>) -> Self
Specify the name of the server, it is only used for logs.
sourcepub async fn run<E>(self, ep: E) -> IoResult<()>where
E: IntoEndpoint,
E::Endpoint: 'static,
pub async fn run<E>(self, ep: E) -> IoResult<()>where
E: IntoEndpoint,
E::Endpoint: 'static,
Run this server.
sourcepub async fn run_with_graceful_shutdown<E>(
self,
ep: E,
signal: impl Future<Output = ()>,
timeout: Option<Duration>
) -> IoResult<()>where
E: IntoEndpoint,
E::Endpoint: 'static,
pub async fn run_with_graceful_shutdown<E>(
self,
ep: E,
signal: impl Future<Output = ()>,
timeout: Option<Duration>
) -> IoResult<()>where
E: IntoEndpoint,
E::Endpoint: 'static,
Run this server and a signal to initiate graceful shutdown.
Auto Trait Implementations
impl<L, A> RefUnwindSafe for Server<L, A>where
A: RefUnwindSafe,
L: RefUnwindSafe,
impl<L, A> Send for Server<L, A>where
A: Send,
L: Send,
impl<L, A> Sync for Server<L, A>where
A: Sync,
L: Sync,
impl<L, A> Unpin for Server<L, A>where
A: Unpin,
L: Unpin,
impl<L, A> UnwindSafe for Server<L, A>where
A: UnwindSafe,
L: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more