[−][src]Struct kayrx::jrpc::Server
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]
R: TransportServer<RequestId = I> + Send + Sync + 'static,
I: Clone + PartialEq + Eq + Hash + Send + Sync + 'static,
Initializes a new server based upon this raw server.
pub fn register_notifications(
&self,
method_name: String,
allow_losses: bool
) -> Result<RegisteredNotifications, ()>
[src]
&self,
method_name: String,
allow_losses: bool
) -> Result<RegisteredNotifications, ()>
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]
&self,
method_name: String
) -> Result<RegisteredMethod, ()>
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]
&self,
subscribe_method_name: String,
unsubscribe_method_name: String
) -> Result<RegisteredSubscription, ()>
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]
R: TransportServer<RequestId = I> + Send + Sync + 'static,
I: Clone + PartialEq + Eq + Hash + Send + Sync + 'static,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,