Expand description
Several different methods for getting, or evaluating, uniqueness.
uniq
returns a vector of unique values within itself as compared to
the other vector which is provided as an input parameter.
use array_tool::vec::Uniq;
vec![1,2,3,4,5,6].uniq( vec![1,2,5,7,9] );
unique
removes duplicates from within the vector and returns Self.
use array_tool::vec::Uniq;
vec![1,2,1,3,2,3,4,5,6].unique();
is_unique
returns boolean value on whether all values within
Self are unique.
use array_tool::vec::Uniq;
vec![1,2,1,3,4,3,4,5,6].is_unique();
uniq_via
returns a vector of unique values within itself as compared to
the other vector which is provided as an input parameter, as defined by a
provided custom comparator.
use array_tool::vec::Uniq;
vec![1,2,3,4,5,6].uniq_via( vec![1,2,5,7,9], |&l, r| l == r + 2 );
unique_via
removes duplicates, as defined by a provided custom comparator,
from within the vector and returns Self.
use array_tool::vec::Uniq;
vec![1.0,2.0,1.4,3.3,2.1,3.5,4.6,5.2,6.2].unique_via( |l: &f64, r: &f64| l.floor() == r.floor() );
vec![1.0,2.0,3.3,4.6,5.2,6.2]
is_unique_via
returns boolean value on whether all values within
Self are unique, as defined by a provided custom comparator.
use array_tool::vec::Uniq;
vec![1.0,2.0,1.4,3.3,2.1,3.5,4.6,5.2,6.2].is_unique_via( |l: &f64, r: &f64| l.floor() == r.floor() );