pub trait DifferenceAll<A, I>{
// Required method
fn difference_all(
&self,
others: Vec<&[I]>,
is_sorted: Option<bool>,
) -> Vec<I>;
}Expand description
A trait that implements the DifferenceAll::difference_all method on arrays.
Required Methods§
Sourcefn difference_all(&self, others: Vec<&[I]>, is_sorted: Option<bool>) -> Vec<I>
fn difference_all(&self, others: Vec<&[I]>, is_sorted: Option<bool>) -> Vec<I>
Creates a vector of values in this array that are not included in the others nested
arrays.
others- The nested values to exclude.is_sorted- The sorted flag. Should be set toSome(true)if you are certain thatotheris a sorted array. Internally, binary search is utilized when this flag is provided and is truthy, enabling searching inO(log n)time, compared to theO(n)time complexity of linear search otherwise.
§Examples
use rodash::DifferenceAll;
assert_eq!(
[2, 1, 2, 3].difference_all(vec![&[3, 4], &[3, 2]], None),
[1]
);