Struct grpcio::ServiceBuilder
source · [−]pub struct ServiceBuilder { /* private fields */ }
Expand description
Service
factory in order to configure the properties.
Use it to build a service which can be registered to a server.
Implementations
sourceimpl ServiceBuilder
impl ServiceBuilder
sourcepub fn new() -> ServiceBuilder
pub fn new() -> ServiceBuilder
Initialize a new ServiceBuilder
.
sourcepub fn add_unary_handler<Req, Resp, F>(
self,
method: &Method<Req, Resp>,
handler: F
) -> ServiceBuilder where
Req: 'static,
Resp: 'static,
F: FnMut(RpcContext<'_>, Req, UnarySink<Resp>) + Send + Clone + 'static,
pub fn add_unary_handler<Req, Resp, F>(
self,
method: &Method<Req, Resp>,
handler: F
) -> ServiceBuilder where
Req: 'static,
Resp: 'static,
F: FnMut(RpcContext<'_>, Req, UnarySink<Resp>) + Send + Clone + 'static,
Add a unary RPC call handler.
sourcepub fn add_client_streaming_handler<Req, Resp, F>(
self,
method: &Method<Req, Resp>,
handler: F
) -> ServiceBuilder where
Req: 'static,
Resp: 'static,
F: FnMut(RpcContext<'_>, RequestStream<Req>, ClientStreamingSink<Resp>) + Send + Clone + 'static,
pub fn add_client_streaming_handler<Req, Resp, F>(
self,
method: &Method<Req, Resp>,
handler: F
) -> ServiceBuilder where
Req: 'static,
Resp: 'static,
F: FnMut(RpcContext<'_>, RequestStream<Req>, ClientStreamingSink<Resp>) + Send + Clone + 'static,
Add a client streaming RPC call handler.
sourcepub fn add_server_streaming_handler<Req, Resp, F>(
self,
method: &Method<Req, Resp>,
handler: F
) -> ServiceBuilder where
Req: 'static,
Resp: 'static,
F: FnMut(RpcContext<'_>, Req, ServerStreamingSink<Resp>) + Send + Clone + 'static,
pub fn add_server_streaming_handler<Req, Resp, F>(
self,
method: &Method<Req, Resp>,
handler: F
) -> ServiceBuilder where
Req: 'static,
Resp: 'static,
F: FnMut(RpcContext<'_>, Req, ServerStreamingSink<Resp>) + Send + Clone + 'static,
Add a server streaming RPC call handler.
sourcepub fn add_duplex_streaming_handler<Req, Resp, F>(
self,
method: &Method<Req, Resp>,
handler: F
) -> ServiceBuilder where
Req: 'static,
Resp: 'static,
F: FnMut(RpcContext<'_>, RequestStream<Req>, DuplexSink<Resp>) + Send + Clone + 'static,
pub fn add_duplex_streaming_handler<Req, Resp, F>(
self,
method: &Method<Req, Resp>,
handler: F
) -> ServiceBuilder where
Req: 'static,
Resp: 'static,
F: FnMut(RpcContext<'_>, RequestStream<Req>, DuplexSink<Resp>) + Send + Clone + 'static,
Add a duplex streaming RPC call handler.
sourcepub fn build(self) -> Service
pub fn build(self) -> Service
Finalize the ServiceBuilder
and build the Service
.
Auto Trait Implementations
impl !RefUnwindSafe for ServiceBuilder
impl Send for ServiceBuilder
impl !Sync for ServiceBuilder
impl Unpin for ServiceBuilder
impl !UnwindSafe for ServiceBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more