[−][src]Struct fibers_rpc::server::ServerBuilder
RPC server builder.
Methods
impl ServerBuilder
[src]
pub fn new(bind_addr: SocketAddr) -> Self
[src]
Makes a new ServerBuilder
instance.
pub fn logger(&mut self, logger: Logger) -> &mut Self
[src]
Sets the logger of the server.
The default value is Logger::root(Discard, o!())
.
pub fn channel_options(&mut self, options: ChannelOptions) -> &mut Self
[src]
Sets ChannelOptions
used by the service.
The default value is ChannelOptions::default()
.
pub fn metrics(&mut self, builder: MetricBuilder) -> &mut Self
[src]
Sets MetricBuilder
used by the service.
The default value is MetricBuilder::new()
.
pub fn add_call_handler<T, H>(&mut self, handler: H) -> &mut Self where
T: Call,
H: HandleCall<T>,
T::ReqDecoder: Default,
T::ResEncoder: Default,
[src]
T: Call,
H: HandleCall<T>,
T::ReqDecoder: Default,
T::ResEncoder: Default,
Registers a handler for the request/response RPC.
This equivalent to
add_call_handler_with_codec(handler, DefaultFactory::new(), DefaultFactory::new())
.
Panices
If a procedure which has T::ID
already have been registered, the calling thread will panic.
pub fn add_call_handler_with_decoder<T, H, D>(
&mut self,
handler: H,
decoder_factory: D
) -> &mut Self where
T: Call,
H: HandleCall<T>,
D: Factory<Item = T::ReqDecoder> + Send + Sync + 'static,
T::ResEncoder: Default,
[src]
&mut self,
handler: H,
decoder_factory: D
) -> &mut Self where
T: Call,
H: HandleCall<T>,
D: Factory<Item = T::ReqDecoder> + Send + Sync + 'static,
T::ResEncoder: Default,
Registers a handler (with the given decoder maker) for the request/response RPC.
This equivalent to add_call_handler_with_codec(handler, decoder_factory, DefaultFactory::new())
.
Panices
If a procedure which has T::ID
already have been registered, the calling thread will panic.
pub fn add_call_handler_with_encoder<T, H, E>(
&mut self,
handler: H,
encoder_factory: E
) -> &mut Self where
T: Call,
H: HandleCall<T>,
E: Factory<Item = T::ResEncoder> + Send + Sync + 'static,
T::ReqDecoder: Default,
[src]
&mut self,
handler: H,
encoder_factory: E
) -> &mut Self where
T: Call,
H: HandleCall<T>,
E: Factory<Item = T::ResEncoder> + Send + Sync + 'static,
T::ReqDecoder: Default,
Registers a handler (with the given encoder maker) for the request/response RPC.
This equivalent to
add_call_handler_with_codec(handler, DefaultFactory::new(), encoder_factory)
.
Panices
If a procedure which has T::ID
already have been registered,
the calling thread will panic.
pub fn add_call_handler_with_codec<T, H, D, E>(
&mut self,
handler: H,
decoder_factory: D,
encoder_factory: E
) -> &mut Self where
T: Call,
H: HandleCall<T>,
D: Factory<Item = T::ReqDecoder> + Send + Sync + 'static,
E: Factory<Item = T::ResEncoder> + Send + Sync + 'static,
[src]
&mut self,
handler: H,
decoder_factory: D,
encoder_factory: E
) -> &mut Self where
T: Call,
H: HandleCall<T>,
D: Factory<Item = T::ReqDecoder> + Send + Sync + 'static,
E: Factory<Item = T::ResEncoder> + Send + Sync + 'static,
Registers a handler (with the given decoder/encoder makers) for the request/response RPC.
Panices
If a procedure which has T::ID
already have been registered, the calling thread will panic.
pub fn add_cast_handler<T, H>(&mut self, handler: H) -> &mut Self where
T: Cast,
H: HandleCast<T>,
T::Decoder: Default,
[src]
T: Cast,
H: HandleCast<T>,
T::Decoder: Default,
Registers a handler for the notification RPC.
This equivalent to add_cast_handler_with_encoder(handler, DefaultFactory::new())
.
Panices
If a procedure which has T::ID
already have been registered, the calling thread will panic.
pub fn add_cast_handler_with_decoder<T, H, D>(
&mut self,
handler: H,
decoder_factory: D
) -> &mut Self where
T: Cast,
H: HandleCast<T>,
D: Factory<Item = T::Decoder> + Send + Sync + 'static,
[src]
&mut self,
handler: H,
decoder_factory: D
) -> &mut Self where
T: Cast,
H: HandleCast<T>,
D: Factory<Item = T::Decoder> + Send + Sync + 'static,
Registers a handler (with the given decoder maker) for the notification RPC.
Panices
If a procedure which has T::ID
already have been registered, the calling thread will panic.
pub fn finish<S>(&mut self, spawner: S) -> Server<S> where
S: Clone + Spawn + Send + 'static,
[src]
S: Clone + Spawn + Send + 'static,
Returns the resulting RPC server.
The invocation of this method consumes all registered handlers.
Trait Implementations
Auto Trait Implementations
impl Send for ServerBuilder
impl !Sync for ServerBuilder
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,