pub struct RpcServerConfig { /* private fields */ }Expand description
Transport settings applied to every gRPC service on a server.
Implementations§
Source§impl RpcServerConfig
impl RpcServerConfig
Sourcepub fn new(address: SocketAddr) -> Self
pub fn new(address: SocketAddr) -> Self
Examples found in repository?
examples/echo_server.rs (line 77)
74async fn main() -> Result<(), Box<dyn std::error::Error>> {
75 let address: SocketAddr = "[::1]:50051".parse()?;
76 let server = RpcServer::new(
77 RpcServerConfig::new(address)
78 .with_request_timeout(Duration::from_secs(10))
79 .with_concurrency_limit(1_024),
80 );
81 let (mut reporter, health_service) = health_reporter();
82 reporter.set_serving::<EchoServer<EchoService>>().await;
83
84 server
85 .router()
86 .add_service(health_service)
87 .add_service(EchoServer::new(EchoService))
88 .serve(server.config().address())
89 .await?;
90 Ok(())
91}Sourcepub fn with_request_timeout(self, timeout: Duration) -> Self
pub fn with_request_timeout(self, timeout: Duration) -> Self
Examples found in repository?
examples/echo_server.rs (line 78)
74async fn main() -> Result<(), Box<dyn std::error::Error>> {
75 let address: SocketAddr = "[::1]:50051".parse()?;
76 let server = RpcServer::new(
77 RpcServerConfig::new(address)
78 .with_request_timeout(Duration::from_secs(10))
79 .with_concurrency_limit(1_024),
80 );
81 let (mut reporter, health_service) = health_reporter();
82 reporter.set_serving::<EchoServer<EchoService>>().await;
83
84 server
85 .router()
86 .add_service(health_service)
87 .add_service(EchoServer::new(EchoService))
88 .serve(server.config().address())
89 .await?;
90 Ok(())
91}Sourcepub fn with_concurrency_limit(self, limit: usize) -> Self
pub fn with_concurrency_limit(self, limit: usize) -> Self
Examples found in repository?
examples/echo_server.rs (line 79)
74async fn main() -> Result<(), Box<dyn std::error::Error>> {
75 let address: SocketAddr = "[::1]:50051".parse()?;
76 let server = RpcServer::new(
77 RpcServerConfig::new(address)
78 .with_request_timeout(Duration::from_secs(10))
79 .with_concurrency_limit(1_024),
80 );
81 let (mut reporter, health_service) = health_reporter();
82 reporter.set_serving::<EchoServer<EchoService>>().await;
83
84 server
85 .router()
86 .add_service(health_service)
87 .add_service(EchoServer::new(EchoService))
88 .serve(server.config().address())
89 .await?;
90 Ok(())
91}pub fn with_max_concurrent_streams(self, limit: u32) -> Self
pub fn with_shutdown_timeout(self, timeout: Duration) -> Self
Sourcepub fn address(&self) -> SocketAddr
pub fn address(&self) -> SocketAddr
Examples found in repository?
examples/echo_server.rs (line 88)
74async fn main() -> Result<(), Box<dyn std::error::Error>> {
75 let address: SocketAddr = "[::1]:50051".parse()?;
76 let server = RpcServer::new(
77 RpcServerConfig::new(address)
78 .with_request_timeout(Duration::from_secs(10))
79 .with_concurrency_limit(1_024),
80 );
81 let (mut reporter, health_service) = health_reporter();
82 reporter.set_serving::<EchoServer<EchoService>>().await;
83
84 server
85 .router()
86 .add_service(health_service)
87 .add_service(EchoServer::new(EchoService))
88 .serve(server.config().address())
89 .await?;
90 Ok(())
91}pub fn shutdown_timeout(&self) -> Duration
pub fn validate(&self) -> Result<(), RpcConfigError>
Trait Implementations§
Source§impl Clone for RpcServerConfig
impl Clone for RpcServerConfig
Source§fn clone(&self) -> RpcServerConfig
fn clone(&self) -> RpcServerConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RpcServerConfig
impl Debug for RpcServerConfig
Source§impl Default for RpcServerConfig
impl Default for RpcServerConfig
Source§impl<'de> Deserialize<'de> for RpcServerConfigwhere
RpcServerConfig: Default,
impl<'de> Deserialize<'de> for RpcServerConfigwhere
RpcServerConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RpcServerConfig
impl RefUnwindSafe for RpcServerConfig
impl Send for RpcServerConfig
impl Sync for RpcServerConfig
impl Unpin for RpcServerConfig
impl UnsafeUnpin for RpcServerConfig
impl UnwindSafe for RpcServerConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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::RequestSource§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