SplitableSpanHelpers

Trait SplitableSpanHelpers 

Source
pub trait SplitableSpanHelpers: Clone {
    // Required method
    fn truncate_h(&mut self, at: usize) -> Self;

    // Provided methods
    fn truncate_keeping_right_h(&mut self, at: usize) -> Self { ... }
    fn split(self, at: usize) -> (Self, Self) { ... }
}

Required Methods§

Source

fn truncate_h(&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.

let initial_len = entry.len();
let rest = entry.truncate(truncate_at);
assert!(initial_len == truncate_at + rest.len());

at parameter must strictly obey 0 < at < entry.len()

Provided Methods§

Source

fn truncate_keeping_right_h(&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(self, at: usize) -> (Self, Self)

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 SplitableSpanHelpers for Range<u32>

Source§

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

Source§

impl<A, B> SplitableSpanHelpers for (A, B)

Source§

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

Source§

impl<V> SplitableSpanHelpers for Option<V>
where V: SplitableSpan,

Source§

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

Implementors§