Skip to main content

Edit

Struct Edit 

Source
pub struct Edit<'a, const N: usize> { /* private fields */ }
Expand description

Exclusive editable prefix and staged writes for one buffer owner.

Implementations§

Source§

impl<'a, const N: usize> Edit<'a, N>

Source

pub fn try_new(spare: Spare<'a>, prefix: &[u8; N]) -> Result<Self, Error>

Stages a new fixed prefix without publishing its owner. Unlike editing an existing prefix, len includes earlier staged bytes and this new prefix; commit publishes the complete staged write.

Source

pub fn bounded(&mut self) -> Writer<'_, 'a, false>

Source

pub fn spare(&mut self) -> Spare<'_>

Stages another suffix while retaining this edit’s disjoint fixed prefix.

Source

pub fn prefix(&mut self) -> &mut [u8; N]

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn commit(self)

Trait Implementations§

Source§

impl<const N: usize> Sink for Edit<'_, N>

Source§

type Error = Error

Source§

fn write_slices<const M: usize>( &mut self, slices: [&[u8]; M], ) -> Result<(), Self::Error>

Source§

fn write_byte(&mut self, byte: u8) -> Result<(), Self::Error>

Source§

fn write_slice(&mut self, bytes: &[u8]) -> Result<(), Self::Error>

Auto Trait Implementations§

§

impl<'a, const N: usize> !Send for Edit<'a, N>

§

impl<'a, const N: usize> !Sync for Edit<'a, N>

§

impl<'a, const N: usize> !UnwindSafe for Edit<'a, N>

§

impl<'a, const N: usize> Freeze for Edit<'a, N>
where &'a mut [u8; N]: Freeze,

§

impl<'a, const N: usize> RefUnwindSafe for Edit<'a, N>
where &'a mut [u8; N]: RefUnwindSafe,

§

impl<'a, const N: usize> Unpin for Edit<'a, N>
where &'a mut [u8; N]: Unpin,

§

impl<'a, const N: usize> UnsafeUnpin for Edit<'a, N>
where &'a mut [u8; N]: UnsafeUnpin,

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
Source§

impl<T> Convert<T> for T

Source§

fn into(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.