[][src]Struct ttv_chat::maybe_owned::MaybeOwnedIndex

pub struct MaybeOwnedIndex {
    pub start: u16,
    pub end: u16,
}

An index into a MaybeOwned.

Fields

start: u16

The start index

end: u16

The end index

Implementations

impl MaybeOwnedIndex[src]

pub const fn raw(start: usize, end: usize) -> MaybeOwnedIndex[src]

Create a new index from this start and end point

pub const fn new(pos: usize) -> MaybeOwnedIndex[src]

Create a new index with the same starting/ending point.

This has the end point to start -- so you can resize/bump/etc the end.

pub const fn offset_by(self, pos: usize) -> MaybeOwnedIndex[src]

Shift the whole start/end pairs by pos amount

pub const fn resize(self, len: usize) -> MaybeOwnedIndex[src]

Grow the end by len amount

pub const fn truncate(self, len: usize) -> MaybeOwnedIndex[src]

Shrink the end by len amount

pub fn replace(&mut self, pos: usize) -> MaybeOwnedIndex[src]

Replace this index with a new one start/ending at pos, returning the old index

pub const fn is_empty(&self) -> bool[src]

Checks whether this index is empty (e.g. start points to the dn)

pub fn bump_tail(&mut self)[src]

Bump the 'end' by 1 unit

pub const fn as_range(self) -> Range<usize>[src]

Get this type as a range

Trait Implementations

impl Clone for MaybeOwnedIndex[src]

impl Copy for MaybeOwnedIndex[src]

impl Debug for MaybeOwnedIndex[src]

impl Default for MaybeOwnedIndex[src]

impl Eq for MaybeOwnedIndex[src]

impl Hash for MaybeOwnedIndex[src]

impl<'a, '_> Index<&'_ MaybeOwnedIndex> for str[src]

type Output = str

The returned type after indexing.

impl<'a, '_> Index<&'_ MaybeOwnedIndex> for MaybeOwned<'a>[src]

type Output = str

The returned type after indexing.

impl<'a> Index<MaybeOwnedIndex> for str[src]

type Output = str

The returned type after indexing.

impl<'a> Index<MaybeOwnedIndex> for MaybeOwned<'a>[src]

type Output = str

The returned type after indexing.

impl IntoOwned<'static> for MaybeOwnedIndex[src]

type Output = MaybeOwnedIndex

The output type

impl Ord for MaybeOwnedIndex[src]

impl PartialEq<MaybeOwnedIndex> for MaybeOwnedIndex[src]

impl PartialOrd<MaybeOwnedIndex> for MaybeOwnedIndex[src]

impl StructuralEq for MaybeOwnedIndex[src]

impl StructuralPartialEq for MaybeOwnedIndex[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.