Skip to main content

Ops

Struct Ops 

#[repr(transparent)]
pub struct Ops([u8]);
Expand description

A validated byte slice known to contain a well-formed sequence of encoded Ops.

This is the borrowed counterpart of super::OpsBuf. Use Ops::new to validate untrusted bytes, then iterate with Ops::iter (or via IntoIterator) or replay them with Ops::apply.

Tuple Fields§

§0: [u8]

Implementations§

§

impl Ops

pub fn new(data: &[u8]) -> Result<&Self, OpDecodeError>

Validates data and return it as a Ops reference.

§Errors

Returns OpDecodeError if any embedded op cannot be decoded.

pub(super) const fn from_validated(data: &[u8]) -> &Self

Wraps data, which the caller has already validated.

pub const fn as_bytes(&self) -> &[u8] ⓘ

Returns the raw encoded bytes backing this slice.

pub const fn is_empty(&self) -> bool

Returns true if there are no operations.

pub const fn iter(&self) -> OpsIter<'_> ⓘ

Returns an iterator over the operations in this buffer.

pub fn apply<S: State + ?Sized>(&self, session: &mut S) -> Result<(), S::Error>

Applies every operation in this buffer to session, in order.

§Errors

Returns the session’s error if it has no room for an operation. The operations before it are applied.

Trait Implementations§

§

impl Debug for Ops

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl<'a> IntoIterator for &'a Ops

§

type Item = Op<'a>

The type of the elements being iterated over.
§

type IntoIter = OpsIter<'a>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl !Sized for Ops

§

impl Freeze for Ops

§

impl RefUnwindSafe for Ops

§

impl Send for Ops

§

impl Sync for Ops

§

impl Unpin for Ops

§

impl UnsafeUnpin for Ops

§

impl UnwindSafe for Ops

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,