Struct Single

Source
pub struct Single<T>(pub T);
Expand description

A SplitableSpan wrapper for any single item.

Tuple Fields§

§0: T

Trait Implementations§

Source§

impl<T> Clone for Single<T>
where T: Clone,

Source§

fn clone(&self) -> Single<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Single<T>
where T: Debug,

Source§

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

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

impl<T> Default for Single<T>
where T: Default,

Source§

fn default() -> Single<T>

Returns the “default value” for a type. Read more
Source§

impl<T> HasLength for Single<T>

Source§

fn len(&self) -> usize

The number of child items in the entry. This is indexed with the size used in truncate.
Source§

fn is_empty(&self) -> bool

Source§

impl<T> Hash for Single<T>
where T: Hash,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> MergableSpan for Single<T>
where T: Clone,

Source§

fn can_append(&self, _other: &Single<T>) -> bool

See if the other item can be appended to self. can_append will always be called immediately before append.
Source§

fn append(&mut self, _other: Single<T>)

Merge the passed item into self. Essentially, self = self + other. Read more
Source§

fn prepend(&mut self, other: Self)

Append an item at the start of this item. self = other + self. Read more
Source§

impl<T> PartialEq for Single<T>
where T: PartialEq,

Source§

fn eq(&self, other: &Single<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> SplitableSpanCtx for Single<T>
where T: Clone,

Source§

type Ctx = ()

Source§

fn truncate_ctx( &mut self, _at: usize, _ctx: &<Single<T> as SplitableSpanCtx>::Ctx, ) -> Single<T>

Split the entry, returning the part of the entry which was jettisoned. After truncating at pos, self.len() == pos and the returned value contains the rest of the items. Read more
Source§

fn truncate_keeping_right_ctx(&mut self, at: usize, ctx: &Self::Ctx) -> Self

The inverse of truncate. This method mutably truncates an item, keeping all content from at..item.len() and returning the item range from 0..at.
Source§

fn split_ctx(self, at: usize, ctx: &Self::Ctx) -> (Self, Self)

Source§

impl<T> Copy for Single<T>
where T: Copy,

Source§

impl<T> Eq for Single<T>
where T: Eq,

Source§

impl<T> StructuralPartialEq for Single<T>

Auto Trait Implementations§

§

impl<T> Freeze for Single<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Single<T>
where T: RefUnwindSafe,

§

impl<T> Send for Single<T>
where T: Send,

§

impl<T> Sync for Single<T>
where T: Sync,

§

impl<T> Unpin for Single<T>
where T: Unpin,

§

impl<T> UnwindSafe for Single<T>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> SplitableSpan for T
where T: SplitableSpanCtx<Ctx = ()>,

Source§

fn truncate(&mut self, at: usize) -> Self

Split the entry, returning the part of the entry which was jettisoned. After truncating at pos, self.len() == pos and the returned value contains the rest of the items. Read more
Source§

fn truncate_keeping_right(&mut self, at: usize) -> Self

The inverse of truncate. This method mutably truncates an item, keeping all content from at..item.len() and returning the item range from 0..at.
Source§

fn split_h(self, at: usize) -> (Self, Self)

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> Trim for T

Source§

fn trim(&mut self, at: usize) -> Option<Self>

Source§

impl<T> TrimCtx for T

Source§

fn trim_ctx(&mut self, at: usize, ctx: &Self::Ctx) -> Option<Self>

Trim self to at most at items. Remainder (if any) is returned.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> ContentTraits for T

Source§

impl<T> SplitAndJoinSpan for T

Source§

impl<T> SplitAndJoinSpanCtx for T