pub enum ItemCommand {
Add,
Update,
Delete,
Unrecognized(String),
}Expand description
What a COMMAND-mode update did to the row named by its key.
In COMMAND mode the subscription is a dynamic table: “each real-time
update may add a new row, delete an existing row or change the content of a
specific row” [docs/spec/04-notifications.md §3.3]. Which of the three
happened is carried in the field whose position SUBCMD reported
[docs/spec/04-notifications.md §3.2], and the row it applies to is named
by the value of the key field.
SPEC-AMBIGUITY (command-literals): the specification names the commands
ADD, DELETE and UPDATE but “nowhere states the literal wire values
carried in the command field of a U notification, nor their casing”
[docs/spec/04-notifications.md §3.3]. This crate matches the three names
case-insensitively — the most permissive reading that cannot admit a
fourth command by accident — and preserves anything else as
ItemCommand::Unrecognized rather than rejecting the update, so a server
that grows a command cannot break a client that does not know it.
Variants§
Add
A row entered the table. Its fields are the ones this update carries.
Update
An existing row changed. The fields this update did not carry keep the values they already had.
Delete
A row left the table. The caller should drop its own representation of
the row named by ItemUpdate::key.
Note what this does not mean for the state this crate keeps: see
the DELETE discussion on ItemUpdate::key.
Unrecognized(String)
The command field held something else. The value is preserved verbatim.
Implementations§
Source§impl ItemCommand
impl ItemCommand
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
The command as an uppercase name, or the preserved literal for
ItemCommand::Unrecognized.
Trait Implementations§
Source§impl Clone for ItemCommand
impl Clone for ItemCommand
Source§fn clone(&self) -> ItemCommand
fn clone(&self) -> ItemCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more