Skip to main content

Span

Struct Span 

Source
pub struct Span<K: Backing = Plain, M = Owned, S = Uninit> { /* private fields */ }
Expand description

Owns one live slot edge and its initialized prefix. The backing and prefix cannot be replaced independently through this capability.

Implementations§

Source§

impl<S: State, L> Span<Plain<L>, Owned, S>
where Plain<L>: Backing,

Source

pub fn freeze(self) -> Span<Plain<L>, Owned, Frozen>

Source§

impl<'pool, S: State, L> Span<Plain<L>, Borrowed<'pool>, S>
where Plain<L>: Backing,

Source

pub fn freeze(self) -> Shared<Option<Edge<Plain<L>, Borrowed<'pool>>>>

Source§

impl<L, M> Span<Plain<L>, M, Uninit>
where Plain<L>: Backing,

Source

pub fn try_append<'a, 'source>( &'a mut self, source: &'source [u8], ) -> Result<Append<'a, &'source [u8], L, M>, Error>

Source§

impl Span<Plain<Layout>, Owned, Uninit>

Source

pub fn try_new(cap: usize) -> Result<Self, CreateError>

Allocates one independently owned writable slot.

Source

pub fn try_copy<const N: usize>( self, source: Slices<'_, N>, ) -> Result<Span<Plain, Owned, Frozen>, Error>

Source§

impl<K: Backing, M, S> Span<K, M, S>

Source

pub const fn len(&self) -> usize

Source

pub fn capacity(&self) -> NonZero<u32>

Source

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

Source

pub fn is_empty(&self) -> bool

Source§

impl<K: Backing, M, S: State> Span<K, M, S>

Source

pub fn truncate(&mut self, len: usize)

Source§

impl<L, M, S: State> Span<Plain<L>, M, S>
where Plain<L>: Backing,

Source

pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ

Source§

impl<L> Span<Plain<L>, Owned, Frozen>
where Plain<L>: Backing,

Source

pub fn into_shared(self) -> Shared

Trait Implementations§

Source§

impl<K: Backing, M, S> AsRef<[u8]> for Span<K, M, S>

Source§

fn as_ref(&self) -> &[u8] ⓘ

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<K: Debug + Backing, M: Debug, S: Debug> Debug for Span<K, M, S>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<K: Backing, M, S> Drop for Span<K, M, S>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<'a, L> From<&'a mut Span<Plain<L>, Owned, Initialized>> for Output<'a, L>
where Plain<L>: Backing,

Source§

fn from(target: &'a mut Span<Plain<L>, Owned, Initialized>) -> Self

Converts to this type from the input type.
Source§

impl<K: Backing, M, S> From<Span<K, M, S>> for Edge<K, M>

Source§

fn from(span: Span<K, M, S>) -> Self

Converts to this type from the input type.
Source§

impl<L, M> From<Span<Plain<L>, M>> for Cursor<L, M>
where Plain<L>: Backing,

Source§

fn from(lease: Span<Plain<L>, M, Uninit>) -> Self

Converts to this type from the input type.
Source§

impl<L, S> Residency for Span<Plain<L>, Owned, S>
where Plain<L>: Backing,

Source§

fn resident(&self) -> usize

Source§

impl<L> Source for Span<Plain<L>, Owned, Frozen>
where Plain<L>: Backing,

Source§

unsafe fn view(&self, bounds: Range<usize>) -> View<'_, Self>

Safety Read more
Source§

unsafe fn into_str(self) -> Str<Self>
where Self: Sized,

Safety Read more
Source§

unsafe fn nonempty(self) -> NonEmpty<Self>
where Self: Sized,

Safety Read more

Auto Trait Implementations§

§

impl<K = Plain, M = Owned, S = Uninit> !RefUnwindSafe for Span<K, M, S>

§

impl<K = Plain, M = Owned, S = Uninit> !Send for Span<K, M, S>

§

impl<K = Plain, M = Owned, S = Uninit> !Sync for Span<K, M, S>

§

impl<K = Plain, M = Owned, S = Uninit> !UnwindSafe for Span<K, M, S>

§

impl<K, M, S> Forget for Span<K, M, S>

§

impl<K, M, S> Freeze for Span<K, M, S>
where *const Header<K> is !null: Freeze, PhantomData<(K, S)>: Freeze, M: Freeze,

§

impl<K, M, S> Move for Span<K, M, S>

§

impl<K, M, S> Unpin for Span<K, M, S>
where K: Unpin, S: Unpin, M: Unpin, *const Header<K> is !null: Unpin,

§

impl<K, M, S> UnsafeUnpin for Span<K, M, S>
where *const Header<K> is !null: UnsafeUnpin, PhantomData<(K, S)>: UnsafeUnpin, M: 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<L, R> Convert<Either<L, R>, 1> for L

Source§

fn into(self) -> Either<L, R>

Source§

unsafe fn take_into(source: *mut Self, place: &mut MaybeUninit<T>)
where Self: Sized,

Safety Read more
Source§

impl<L, R> Convert<Either<L, R>, 2> for R

Source§

fn into(self) -> Either<L, R>

Source§

unsafe fn take_into(source: *mut Self, place: &mut MaybeUninit<T>)
where Self: Sized,

Safety Read more
Source§

impl<T> Convert<T> for T

Source§

fn into(self) -> T

Source§

unsafe fn take_into(source: *mut Self, place: &mut MaybeUninit<T>)
where Self: Sized,

Safety Read more
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> SpareExt for T
where T: Exclusive,

Source§

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

Starts a staged writer over this owner’s unpublished suffix.
Source§

fn try_prefix<const N: usize>( &mut self, offset: usize, ) -> Result<Edit<'_, N>, Error>

Stages the initialized prefix of N bytes at offset for editing.
Source§

impl<T> Target for T
where T: Stable,

Source§

fn capacity(&self) -> usize

Source§

fn truncate(&mut self, len: usize)

Source§

unsafe fn spare(&mut self) -> &mut [MaybeUninit<u8>]

Safety Read more
Source§

unsafe fn complete(&mut self, amount: usize)

Safety Read more
Source§

unsafe fn set_len(&mut self, len: usize)

Safety Read more
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.