[−][src]Struct ttv_chat::maybe_owned::MaybeOwnedIndex
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]
fn clone(&self) -> MaybeOwnedIndex
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for MaybeOwnedIndex
[src]
impl Debug for MaybeOwnedIndex
[src]
impl Default for MaybeOwnedIndex
[src]
fn default() -> MaybeOwnedIndex
[src]
impl Eq for MaybeOwnedIndex
[src]
impl Hash for MaybeOwnedIndex
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, '_> Index<&'_ MaybeOwnedIndex> for str
[src]
type Output = str
The returned type after indexing.
fn index(
&self,
index: &MaybeOwnedIndex
) -> &<str as Index<&'_ MaybeOwnedIndex>>::Output
[src]
&self,
index: &MaybeOwnedIndex
) -> &<str as Index<&'_ MaybeOwnedIndex>>::Output
impl<'a, '_> Index<&'_ MaybeOwnedIndex> for MaybeOwned<'a>
[src]
type Output = str
The returned type after indexing.
fn index(
&self,
index: &MaybeOwnedIndex
) -> &<MaybeOwned<'a> as Index<&'_ MaybeOwnedIndex>>::Output
[src]
&self,
index: &MaybeOwnedIndex
) -> &<MaybeOwned<'a> as Index<&'_ MaybeOwnedIndex>>::Output
impl<'a> Index<MaybeOwnedIndex> for str
[src]
type Output = str
The returned type after indexing.
fn index(
&self,
index: MaybeOwnedIndex
) -> &<str as Index<MaybeOwnedIndex>>::Output
[src]
&self,
index: MaybeOwnedIndex
) -> &<str as Index<MaybeOwnedIndex>>::Output
impl<'a> Index<MaybeOwnedIndex> for MaybeOwned<'a>
[src]
type Output = str
The returned type after indexing.
fn index(
&self,
index: MaybeOwnedIndex
) -> &<MaybeOwned<'a> as Index<MaybeOwnedIndex>>::Output
[src]
&self,
index: MaybeOwnedIndex
) -> &<MaybeOwned<'a> as Index<MaybeOwnedIndex>>::Output
impl IntoOwned<'static> for MaybeOwnedIndex
[src]
type Output = MaybeOwnedIndex
The output type
fn into_owned(self) -> <MaybeOwnedIndex as IntoOwned<'static>>::Output
[src]
impl Ord for MaybeOwnedIndex
[src]
fn cmp(&self, other: &MaybeOwnedIndex) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<MaybeOwnedIndex> for MaybeOwnedIndex
[src]
fn eq(&self, other: &MaybeOwnedIndex) -> bool
[src]
fn ne(&self, other: &MaybeOwnedIndex) -> bool
[src]
impl PartialOrd<MaybeOwnedIndex> for MaybeOwnedIndex
[src]
fn partial_cmp(&self, other: &MaybeOwnedIndex) -> Option<Ordering>
[src]
fn lt(&self, other: &MaybeOwnedIndex) -> bool
[src]
fn le(&self, other: &MaybeOwnedIndex) -> bool
[src]
fn gt(&self, other: &MaybeOwnedIndex) -> bool
[src]
fn ge(&self, other: &MaybeOwnedIndex) -> bool
[src]
impl StructuralEq for MaybeOwnedIndex
[src]
impl StructuralPartialEq for MaybeOwnedIndex
[src]
Auto Trait Implementations
impl RefUnwindSafe for MaybeOwnedIndex
impl Send for MaybeOwnedIndex
impl Sync for MaybeOwnedIndex
impl Unpin for MaybeOwnedIndex
impl UnwindSafe for MaybeOwnedIndex
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,