[−][src]Struct tonic::transport::Server
feature="transport"
only.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.
Methods
impl Server
[src]
pub fn builder() -> Self
[src]
feature="transport"
only.Create a new server builder that can configure a Server
.
impl Server
[src]
ⓘImportant traits for &'_ mut Fpub fn tls_config(&mut self, tls_config: &ServerTlsConfig) -> &mut Self
[src]
feature="transport"
only.Configure TLS for this server.
ⓘImportant traits for &'_ mut Fpub fn concurrency_limit_per_connection(&mut self, limit: usize) -> &mut Self
[src]
feature="transport"
only.Set the concurrency limit applied to on requests inbound per connection.
builder.concurrency_limit_per_connection(32);
ⓘImportant traits for &'_ mut Fpub fn initial_stream_window_size(
&mut self,
sz: impl Into<Option<u32>>
) -> &mut Self
[src]
&mut self,
sz: impl Into<Option<u32>>
) -> &mut Self
feature="transport"
only.Sets the SETTINGS_INITIAL_WINDOW_SIZE
option for HTTP2
stream-level flow control.
Default is 65,535
ⓘImportant traits for &'_ mut Fpub fn initial_connection_window_size(
&mut self,
sz: impl Into<Option<u32>>
) -> &mut Self
[src]
&mut self,
sz: impl Into<Option<u32>>
) -> &mut Self
feature="transport"
only.Sets the max connection-level flow control for HTTP2
Default is 65,535
ⓘImportant traits for &'_ mut Fpub fn max_concurrent_streams(
&mut self,
max: impl Into<Option<u32>>
) -> &mut Self
[src]
&mut self,
max: impl Into<Option<u32>>
) -> &mut Self
feature="transport"
only.Sets the SETTINGS_MAX_CONCURRENT_STREAMS
option for HTTP2
connections.
Default is no limit (None
).
ⓘImportant traits for &'_ mut Fpub fn interceptor_fn<F, Out>(&mut self, f: F) -> &mut Self where
F: Fn(&mut BoxService<Request<Body>, Response<BoxBody>, Box<dyn Error + Send + Sync>>, Request<Body>) -> Out + Send + Sync + 'static,
Out: Future<Output = Result<Response<BoxBody>, Box<dyn Error + Send + Sync>>> + Send + 'static,
[src]
F: Fn(&mut BoxService<Request<Body>, Response<BoxBody>, Box<dyn Error + Send + Sync>>, Request<Body>) -> Out + Send + Sync + 'static,
Out: Future<Output = Result<Response<BoxBody>, Box<dyn Error + Send + Sync>>> + Send + 'static,
feature="transport"
only.Intercept the execution of gRPC methods.
builder.interceptor_fn(|svc, req| { println!("request={:?}", req); svc.call(req) });
pub async fn serve<M, S>(self, addr: SocketAddr, svc: M) -> Result<(), Error> where
M: Service<(), Response = S>,
M::Error: Into<Box<dyn Error + Send + Sync>> + Send + 'static,
M::Future: Send + 'static,
S: Service<Request<Body>, Response = Response<BoxBody>> + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync>> + Send,
[src]
M: Service<(), Response = S>,
M::Error: Into<Box<dyn Error + Send + Sync>> + Send + 'static,
M::Future: Send + 'static,
S: Service<Request<Body>, Response = Response<BoxBody>> + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync>> + Send,
feature="transport"
only.Trait Implementations
Auto Trait Implementations
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
impl !RefUnwindSafe for Server
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
ⓘImportant traits for &'_ mut Ffn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,