[][src]Struct fibers_rpc::server::ServerBuilder

pub struct ServerBuilder { /* fields omitted */ }

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]

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]

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]

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]

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]

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]

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>(self, spawner: S) -> Server<S> where
    S: Clone + Spawn + Send + 'static, 
[src]

Returns the resulting RPC server.

Trait Implementations

impl Debug for ServerBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]