Struct tonic::transport::server::Server [−][src]
A default batteries included transport
server.
This is a wrapper around hyper::Server
and provides an easy builder
pattern style builder Server
. This builder exposes easy configuration parameters
for providing a fully featured http2 based gRPC server. This should provide
a very good out of the box http2 server for use with tonic but is also a
reference implementation that should be a good starting point for anyone
wanting to create a more complex and/or specific implementation.
Implementations
impl Server
[src]
impl Server
[src]
pub fn tls_config(self, tls_config: ServerTlsConfig) -> Result<Self, Error>
[src]
Configure TLS for this server.
pub fn concurrency_limit_per_connection(self, limit: usize) -> Self
[src]
Set the concurrency limit applied to on requests inbound per connection.
Example
builder.concurrency_limit_per_connection(32);
pub fn timeout(&mut self, timeout: Duration) -> &mut Selfⓘ
[src]
pub fn initial_stream_window_size(self, sz: impl Into<Option<u32>>) -> Self
[src]
Sets the SETTINGS_INITIAL_WINDOW_SIZE
option for HTTP2
stream-level flow control.
Default is 65,535
pub fn initial_connection_window_size(self, sz: impl Into<Option<u32>>) -> Self
[src]
Sets the max connection-level flow control for HTTP2
Default is 65,535
pub fn max_concurrent_streams(self, max: impl Into<Option<u32>>) -> Self
[src]
Sets the SETTINGS_MAX_CONCURRENT_STREAMS
option for HTTP2
connections.
Default is no limit (None
).
pub fn tcp_keepalive(self, tcp_keepalive: Option<Duration>) -> Self
[src]
Set whether TCP keepalive messages are enabled on accepted connections.
If None
is specified, keepalive is disabled, otherwise the duration
specified will be the time to remain idle before sending TCP keepalive
probes.
Default is no keepalive (None
)
pub fn tcp_nodelay(self, enabled: bool) -> Self
[src]
Set the value of TCP_NODELAY
option for accepted connections. Enabled by default.
pub fn trace_fn<F>(self, f: F) -> Self where
F: Fn(&HeaderMap) -> Span + Send + Sync + 'static,
[src]
F: Fn(&HeaderMap) -> Span + Send + Sync + 'static,
Intercept inbound headers and add a tracing::Span
to each response future.
pub fn add_service<S>(&mut self, svc: S) -> Router<S, Unimplemented> where
S: Service<Request<Body>, Response = Response<BoxBody>> + NamedService + Clone + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync>> + Send,
[src]
S: Service<Request<Body>, Response = Response<BoxBody>> + NamedService + Clone + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync>> + Send,
Create a router with the S
typed service as the first service.
This will clone the Server
builder and create a router that will
route around different services.
pub fn add_optional_service<S>(
&mut self,
svc: Option<S>
) -> Router<Either<S, Unimplemented>, Unimplemented> where
S: Service<Request<Body>, Response = Response<BoxBody>> + NamedService + Clone + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync>> + Send,
[src]
&mut self,
svc: Option<S>
) -> Router<Either<S, Unimplemented>, Unimplemented> where
S: Service<Request<Body>, Response = Response<BoxBody>> + NamedService + Clone + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync>> + Send,
Create a router with the optional S
typed service as the first service.
This will clone the Server
builder and create a router that will
route around different services.
Note
Even when the argument given is None
this will capture all requests to this service name.
As a result, one cannot use this to toggle between two identically named implementations.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut Tⓘ
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
pub fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
pub fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a Tⓘ
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tⓘ
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
[src]
Notable traits for WithDispatch<T>
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
S: Into<Dispatch>,
pub fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
[src]
Notable traits for WithDispatch<T>
impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;