pub struct Server<T> { /* private fields */ }Expand description
Generic gRPC server that can handle any service type This eliminates the need for duplicate Server implementations across all service files
Implementations§
Source§impl<T> Server<T>
impl<T> Server<T>
Sourcepub async fn start_with_shutdown<F>(
self,
shutdown_rx: Receiver<()>,
service_builder: F,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn start_with_shutdown<F>( self, shutdown_rx: Receiver<()>, service_builder: F, ) -> Result<(), Box<dyn Error + Send + Sync>>
Starts the gRPC server with a custom service builder function.
When message is received on the shutdown channel, graceful shutdown of the gRPC server will be initiated.
Sourcepub async fn start<F>(
self,
service_builder: F,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn start<F>( self, service_builder: F, ) -> Result<(), Box<dyn Error + Send + Sync>>
Starts the gRPC server with a custom service builder function. Automatically registers signal handlers for SIGINT and SIGTERM and initiates graceful shutdown of gRPC server when either one of the signal arrives.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Server<T>where
T: Freeze,
impl<T> RefUnwindSafe for Server<T>where
T: RefUnwindSafe,
impl<T> Send for Server<T>where
T: Send,
impl<T> Sync for Server<T>where
T: Sync,
impl<T> Unpin for Server<T>where
T: Unpin,
impl<T> UnwindSafe for Server<T>where
T: UnwindSafe,
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> 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