Enum Op
pub enum Op<'a> {
Store(Store<'a>),
Modify(Modify<'a>),
}Expand description
A mutation to session state, in a form that can be serialized and replayed.
Passed to State::apply to replay a mutation. A
persistence backend can also match on it to map each operation onto its
own representation (e.g. SQL statements), the same way
Property is matched.
Variants§
Store(Store<'a>)
Stores new data. Can fail if the session has no room for it.
Modify(Modify<'a>)
Changes or removes stored data. Never needs new storage.
Implementations§
§impl<'a> Op<'a>
impl<'a> Op<'a>
pub const fn store_outbox(packet_id: PacketId, entry: &OutboxEntry<'a>) -> Self
pub const fn store_outbox(packet_id: PacketId, entry: &OutboxEntry<'a>) -> Self
Creates an operation to store an outgoing publish from an
OutboxEntry, preserving its QoS.
pub const fn remove_outbox(packet_id: PacketId) -> Self
pub const fn remove_outbox(packet_id: PacketId) -> Self
Creates an operation to remove an outgoing publish from the outbox.
pub const fn store_qos2_pubcomp(packet_id: PacketId) -> Self
pub const fn store_qos2_pubcomp(packet_id: PacketId) -> Self
Creates an operation to store a QoS 2 entry directly in the
awaiting-PUBCOMP state.
pub const fn remove_pubrel(packet_id: PacketId) -> Self
pub const fn remove_pubrel(packet_id: PacketId) -> Self
Creates an operation to remove a QoS 2 entry from the
awaiting-PUBCOMP phase (pubrel-pending set).
pub const fn store_incoming_qos2(packet_id: PacketId) -> Self
pub const fn store_incoming_qos2(packet_id: PacketId) -> Self
Creates an operation to store an incoming QoS 2 publish in the
awaiting-PUBREL phase.
pub const fn remove_incoming_qos2(packet_id: PacketId) -> Self
pub const fn remove_incoming_qos2(packet_id: PacketId) -> Self
Creates an operation to remove an incoming QoS 2 publish.
pub const fn clear() -> Self
pub const fn clear() -> Self
Creates an operation to clear all in-flight session state.
pub const fn store_filter(filter: &'a TopicFilter, state: FilterState) -> Self
pub const fn store_filter(filter: &'a TopicFilter, state: FilterState) -> Self
Creates an operation to store (or replace) a filter entry verbatim.
pub const fn remove_filter(filter: &'a TopicFilter) -> Self
pub const fn remove_filter(filter: &'a TopicFilter) -> Self
Creates an operation to remove a filter entry.
pub const fn mark_sent(packet_id: PacketId) -> Self
pub const fn mark_sent(packet_id: PacketId) -> Self
Creates an operation that marks a pending QoS 1 or QoS 2 publish as
having been written to the wire at least once.
pub fn decode(r: &mut Reader<'a>) -> Result<Self, OpDecodeError>
pub fn decode(r: &mut Reader<'a>) -> Result<Self, OpDecodeError>
Decodes an operation from the provided reader.
§Errors
Returns OpDecodeError if the reader contains invalid data.
pub(crate) fn decode_as(
r: &mut Reader<'a>,
layout: Layout,
) -> Result<Self, OpDecodeError>
pub(crate) fn decode_as( r: &mut Reader<'a>, layout: Layout, ) -> Result<Self, OpDecodeError>
Decodes an operation encoded in layout.
Trait Implementations§
impl<'a> Copy for Op<'a>
Auto Trait Implementations§
impl<'a> Freeze for Op<'a>
impl<'a> RefUnwindSafe for Op<'a>
impl<'a> Send for Op<'a>
impl<'a> Sync for Op<'a>
impl<'a> Unpin for Op<'a>
impl<'a> UnsafeUnpin for Op<'a>
impl<'a> UnwindSafe for Op<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more