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.
Trait Implementations§
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<Data> ApiSuccessResponse for Data
impl<Data> ApiSuccessResponse for Data
fn api_response<Meta>(self, meta: Option<Meta>) -> ApiResponse<Self, Meta>
fn api_response_without_meta<Meta>(self) -> ApiResponse<Self, Meta>
fn api_response_with_meta<Meta>(self, meta: Meta) -> ApiResponse<Self, Meta>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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