zerotrie::helpers

Trait MaybeSplitAt

Source
pub(crate) trait MaybeSplitAt<T> {
    // Required methods
    fn maybe_split_at(&self, mid: usize) -> Option<(&Self, &Self)>;
    fn debug_split_at(&self, mid: usize) -> (&Self, &Self);
}

Required Methods§

Source

fn maybe_split_at(&self, mid: usize) -> Option<(&Self, &Self)>

Like slice::split_at but returns an Option instead of panicking if the index is out of range.

Source

fn debug_split_at(&self, mid: usize) -> (&Self, &Self)

Like slice::split_at but debug-panics and returns an empty second slice if the index is out of range.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> MaybeSplitAt<T> for [T]

Source§

fn maybe_split_at(&self, mid: usize) -> Option<(&Self, &Self)>

Source§

fn debug_split_at(&self, mid: usize) -> (&Self, &Self)

Implementors§