pub struct ServiceModuleDefinition<Context> { /* private fields */ }Expand description
It stores all procedures defined for a RPC service
Implementations§
Source§impl<Context> ServiceModuleDefinition<Context>
impl<Context> ServiceModuleDefinition<Context>
pub fn new() -> Self
Sourcepub fn add_unary<H: Fn(CommonPayload, ProcedureContext<Context>) -> UnaryResponse + Send + Sync + 'static>(
&mut self,
name: &str,
handler: H,
)
pub fn add_unary<H: Fn(CommonPayload, ProcedureContext<Context>) -> UnaryResponse + Send + Sync + 'static>( &mut self, name: &str, handler: H, )
Add an unary procedure handler to the service definition
Sourcepub fn add_server_streams<H: Fn(CommonPayload, ProcedureContext<Context>) -> ServerStreamsResponse + Send + Sync + 'static>(
&mut self,
name: &str,
handler: H,
)
pub fn add_server_streams<H: Fn(CommonPayload, ProcedureContext<Context>) -> ServerStreamsResponse + Send + Sync + 'static>( &mut self, name: &str, handler: H, )
Add a server streams procedure handler to the service definition
Sourcepub fn add_client_streams<H: Fn(ClientStreamsPayload, ProcedureContext<Context>) -> ClientStreamsResponse + Send + Sync + 'static>(
&mut self,
name: &str,
handler: H,
)
pub fn add_client_streams<H: Fn(ClientStreamsPayload, ProcedureContext<Context>) -> ClientStreamsResponse + Send + Sync + 'static>( &mut self, name: &str, handler: H, )
Add a client streams procedure handler to the service definition
Sourcepub fn add_bidir_streams<H: Fn(BiStreamsPayload, ProcedureContext<Context>) -> BiStreamsResponse + Send + Sync + 'static>(
&mut self,
name: &str,
handler: H,
)
pub fn add_bidir_streams<H: Fn(BiStreamsPayload, ProcedureContext<Context>) -> BiStreamsResponse + Send + Sync + 'static>( &mut self, name: &str, handler: H, )
Add a bidirectional streams procedure handler to the service definition
pub fn get_definitions(&self) -> &HashMap<String, ProcedureDefinition<Context>>
Trait Implementations§
Auto Trait Implementations§
impl<Context> Freeze for ServiceModuleDefinition<Context>
impl<Context> !RefUnwindSafe for ServiceModuleDefinition<Context>
impl<Context> Send for ServiceModuleDefinition<Context>
impl<Context> Sync for ServiceModuleDefinition<Context>
impl<Context> Unpin for ServiceModuleDefinition<Context>
impl<Context> !UnwindSafe for ServiceModuleDefinition<Context>
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> 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 more