Request

Enum Request 

Source
pub enum Request<Val = Value> {
    Set {
        key: String,
        value: Val,
    },
    Get {
        key: String,
    },
    Subscribe {
        key: String,
        notify_now: bool,
    },
    Unsubscribe {
        key: String,
    },
}
Expand description

Request sent from client to server.

This enum represents possible requests accepted by the server. See the documentation of its variants to understand possible requests.

This enum is parametric over value type in order to skip conversions to json::Value when sending the request.

Variants§

§

Set

Sets the value of key to value

There’s no response, but if the client is subscribed with the key, it will get the notification.

Fields

§value: Val
§

Get

Gets the value of the key

Response of type Value follows this request.

Fields

§

Subscribe

Requests notifications when any of the keys change.

If notify_now is set to true, the client is also notified immediately after the response.

The response is either OperationOk, if the cliet was subscribed or Ignored, if the client was already subscribed.

Fields

§notify_now: bool
§

Unsubscribe

Requests the server to stop notifying the client

Note that this isn’t necessary if the client is going to disconnect - the subscribtions of the client are automatically cleared on disconnect.

If the unsubscribe operation was performed, OperationOk response is sent. If the client wasn’t subscribed, Ignored is sent.

Fields

Auto Trait Implementations§

§

impl<Val> Freeze for Request<Val>
where Val: Freeze,

§

impl<Val> RefUnwindSafe for Request<Val>
where Val: RefUnwindSafe,

§

impl<Val> Send for Request<Val>
where Val: Send,

§

impl<Val> Sync for Request<Val>
where Val: Sync,

§

impl<Val> Unpin for Request<Val>
where Val: Unpin,

§

impl<Val> UnwindSafe for Request<Val>
where Val: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.