Enum dscfg_proto::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

Fields

key: String
value: Val

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.

Get

Fields

key: String

Gets the value of the key

Response of type Value follows this request.

Subscribe

Fields

key: String
notify_now: bool

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.

Unsubscribe

Fields

key: String

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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.