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 util 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<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
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
source§impl<T> FutureTraceExt for Twhere
T: FutureExt,
impl<T> FutureTraceExt for Twhere
T: FutureExt,
source§fn with_current_context_span(self, otel_span: Span) -> WithContext<Self> ⓘ
fn with_current_context_span(self, otel_span: Span) -> WithContext<Self> ⓘ
Pass the span of opentelemetry to the current context of tracing.
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request