[][src]Struct kayrx::jrpc::Server

pub struct Server { /* fields omitted */ }

Server that can be cloned.

Note: This struct is designed to be easy to use, but it works by maintaining a background task running in parallel. If this is not desirable, you are encouraged to use the RawServer struct instead.

Methods

impl Server[src]

pub fn new<R, I>(server: RawServer<R, I>) -> Server where
    R: TransportServer<RequestId = I> + Send + Sync + 'static,
    I: Clone + PartialEq + Eq + Hash + Send + Sync + 'static, 
[src]

Initializes a new server based upon this raw server.

pub fn register_notifications(
    &self,
    method_name: String,
    allow_losses: bool
) -> Result<RegisteredNotifications, ()>
[src]

Registers a notification method name towards the server.

Clients will then be able to call this method. The returned object allows you to process incoming notifications.

If allow_losses is true, then the server is allowed to drop notifications if the notifications handler (i.e. the code that uses [RegisteredNotifications]) is too slow to process notifications.

Returns an error if the method name was already registered.

pub fn register_method(
    &self,
    method_name: String
) -> Result<RegisteredMethod, ()>
[src]

Registers a method towards the server.

Clients will then be able to call this method. The returned object allows you to handle incoming requests.

Contrary to register_notifications, there is no allow_losses parameter here. If the handler is too slow to process requests, then the server automatically returns an "internal error" to the client.

Returns an error if the method name was already registered.

pub fn register_subscription(
    &self,
    subscribe_method_name: String,
    unsubscribe_method_name: String
) -> Result<RegisteredSubscription, ()>
[src]

Registers a subscription towards the server.

Clients will then be able to call this method. The returned object allows you to send out notifications.

Returns an error if one of the method names was already registered.

Trait Implementations

impl Clone for Server[src]

impl<R, I> From<RawServer<R, I>> for Server where
    R: TransportServer<RequestId = I> + Send + Sync + 'static,
    I: Clone + PartialEq + Eq + Hash + Send + Sync + 'static, 
[src]

Initializes a new server based upon this raw server.

Auto Trait Implementations

impl !RefUnwindSafe for Server

impl Send for Server

impl Sync for Server

impl Unpin for Server

impl !UnwindSafe for Server

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,