Weave

Trait Weave 

Source
pub trait Weave<T = Self> {
    // Required methods
    fn over(self, other: T) -> Self;
    fn under(self, other: T) -> Self;
}
Expand description

Trait for layered type merging.

Required Methods§

Source

fn over(self, other: T) -> Self

Merge the values, prioritizing self.

§Example
let a = Some("a");
let b = Some("b");

assert_eq!(a.over(b), Some("a"));
Source

fn under(self, other: T) -> Self

Merge the values, prioritizing other.

§Example
let a = Some("a");
let b = Some("b");

assert_eq!(a.under(b), Some("b"));

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 Weave for bool

Source§

fn over(self, other: Self) -> Self

Source§

fn under(self, other: Self) -> Self

Source§

impl<T> Weave for Option<T>

Source§

fn over(self, other: Self) -> Self

Source§

fn under(self, other: Self) -> Self

Implementors§