Struct SessionOps
#[repr(transparent)]pub struct SessionOps([u8]);Expand description
A validated byte slice known to contain a well-formed sequence of
encoded SessionOps.
This is the borrowed counterpart of super::SessionOpsBuf. Use
SessionOps::new to validate untrusted bytes, then iterate with
SessionOps::iter (or via IntoIterator) or replay them with
SessionOps::apply.
Tuple Fields§
§0: [u8]Implementations§
§impl SessionOps
impl SessionOps
pub fn new(data: &[u8]) -> Result<&Self, OpDecodeError>
pub fn new(data: &[u8]) -> Result<&Self, OpDecodeError>
Validates data and return it as a SessionOps reference.
§Errors
Returns OpDecodeError if any embedded op cannot be decoded.
pub const unsafe fn new_unchecked(data: &[u8]) -> &Self
pub const unsafe fn new_unchecked(data: &[u8]) -> &Self
Wraps data as a SessionOps reference without validation.
§Safety
data must be a complete, well-formed sequence of encoded
SessionOps. That is, iterating it through Reader and
SessionOp::decode must succeed for every op until the reader is
empty. Violating this invariant is undefined behaviour because
downstream code (notably SessionOpsIter) relies on it to elide
error handling.
pub const fn iter(&self) -> SessionOpsIter<'_> ⓘ
pub const fn iter(&self) -> SessionOpsIter<'_> ⓘ
Returns an iterator over the operations in this buffer.
pub fn apply<S: SessionState>(&self, session: &mut S)
pub fn apply<S: SessionState>(&self, session: &mut S)
Apply every operation in this buffer to session, in order.