#[repr(u8)]pub enum SubscriptionMode {
Raw = 0,
Merge = 1,
Distinct = 2,
Command = 3,
}Expand description
How the server treats the items of a subscription
[docs/spec/03-requests.md §6.1].
The mode is not a preference — it changes what the data means, and an item may only be subscribed in the modes its Data Adapter supports.
| Mode | The server keeps | A snapshot is | Typical use |
|---|---|---|---|
Merge | the current value of every field | the current state | a quote: price, bid, ask |
Distinct | recent events, unmerged | the most recent events | a news feed, a chat |
Command | a keyed table | the rows of the table | an order book, a portfolio |
Raw | nothing | not available | a firehose you filter yourself |
In every mode but Raw the server may filter, buffer and limit the flow;
Raw forwards each update as it is and is the one mode with no server-side
bookkeeping at all.
Variants§
Raw = 0
Every update is forwarded as-is. No item state is kept, no snapshot is available, and no filtering is applied.
Merge = 1
The server keeps the current value of each field and merges each update into it, so an update carries only what changed and a snapshot is the current state.
Distinct = 2
Each update is a distinct event that does not replace the previous one. A snapshot is the most recent events, up to a length the server or the subscription chooses.
Command = 3
Updates carry ADD, UPDATE and DELETE commands against a key
field, forming a table. The field schema must contain a key field
and a command field, or the server rejects the subscription with
Appendix B code 15 or 16 [docs/spec/05-error-codes.md §2].
Implementations§
Trait Implementations§
Source§impl Clone for SubscriptionMode
impl Clone for SubscriptionMode
Source§fn clone(&self) -> SubscriptionMode
fn clone(&self) -> SubscriptionMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more