SplitableSpan

Trait SplitableSpan 

Source
pub trait SplitableSpan: SplitableSpanCtx<Ctx = ()> {
    // Provided methods
    fn truncate(&mut self, at: usize) -> Self { ... }
    fn truncate_keeping_right(&mut self, at: usize) -> Self { ... }
    fn split_h(self, at: usize) -> (Self, Self) { ... }
}

Provided Methods§

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.

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()

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)

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.

Implementors§