array_tool::vec

Trait Union

Source
pub trait Union {
    // Required method
    fn union(&self, other: Self) -> Self;
}
Expand description

Create a union between two vectors. Returns a new vector by joining with other, excluding any duplicates and preserving the order from the original vector.

Required Methods§

Source

fn union(&self, other: Self) -> Self

§Example
use array_tool::vec::Union;

vec!["a","b","c"].union(vec!["c","d","a"]);
§Output
vec![ "a", "b", "c", "d" ]

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: PartialEq + Clone> Union for Vec<T>

Source§

fn union(&self, other: Vec<T>) -> Vec<T>

Implementors§