MergableSpan

Trait MergableSpan 

Source
pub trait MergableSpan: Clone {
    // Required methods
    fn can_append(&self, other: &Self) -> bool;
    fn append(&mut self, other: Self);

    // Provided method
    fn prepend(&mut self, other: Self) { ... }
}

Required Methods§

Source

fn can_append(&self, other: &Self) -> bool

See if the other item can be appended to self. can_append will always be called immediately before append.

Source

fn append(&mut self, other: Self)

Merge the passed item into self. Essentially, self = self + other.

The other item must be a valid target for merging (as per can_append(), above).

Provided Methods§

Source

fn prepend(&mut self, other: Self)

Append an item at the start of this item. self = other + self.

This item must be a valid append target for other. That is, other.can_append(self) must be true for this method to be called.

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

Source§

fn can_append(&self, other: &Self) -> bool

Source§

fn append(&mut self, other: Self)

Source§

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

Source§

fn can_append(&self, other: &Self) -> bool

Source§

fn append(&mut self, other: Self)

Implementors§