pub trait Cover<Rhs> {
// Required methods
fn find_cover<'a>(
&self,
others: impl IntoIterator<Item = &'a Rhs>,
) -> (Vec<usize>, Rhs)
where Rhs: 'a;
fn cover<'a>(
&self,
others: impl IntoIterator<Item = &'a Rhs>,
) -> (Vec<&'a Rhs>, Rhs)
where Rhs: 'a;
fn cover_by<'a, T>(
&self,
others: impl IntoIterator<Item = &'a T>,
f: impl Fn(&T) -> &Rhs,
) -> (Vec<&'a T>, Rhs)
where T: 'a;
}Expand description
Set cover methods.
Required Methods§
Sourcefn find_cover<'a>(
&self,
others: impl IntoIterator<Item = &'a Rhs>,
) -> (Vec<usize>, Rhs)where
Rhs: 'a,
fn find_cover<'a>(
&self,
others: impl IntoIterator<Item = &'a Rhs>,
) -> (Vec<usize>, Rhs)where
Rhs: 'a,
Finds the positions of the fewest sets from others which exactly
cover self.
Returns a tuple containing:
- A vector of indices of the sets that cover
self(empty if no coverage at all). - Any uncovered elements (empty if complete coverage is achieved).
Sourcefn cover<'a>(
&self,
others: impl IntoIterator<Item = &'a Rhs>,
) -> (Vec<&'a Rhs>, Rhs)where
Rhs: 'a,
fn cover<'a>(
&self,
others: impl IntoIterator<Item = &'a Rhs>,
) -> (Vec<&'a Rhs>, Rhs)where
Rhs: 'a,
Finds the fewest sets from others which exactly cover self.
Returns a tuple containing:
- A vector of sets that cover
self(empty if no coverage at all). - Any uncovered elements (empty if complete coverage is achieved).
Sourcefn cover_by<'a, T>(
&self,
others: impl IntoIterator<Item = &'a T>,
f: impl Fn(&T) -> &Rhs,
) -> (Vec<&'a T>, Rhs)where
T: 'a,
fn cover_by<'a, T>(
&self,
others: impl IntoIterator<Item = &'a T>,
f: impl Fn(&T) -> &Rhs,
) -> (Vec<&'a T>, Rhs)where
T: 'a,
Finds the fewest sets from others which exactly cover self.
Returns a tuple containing:
- A vector of items that cover
self(empty if no coverage at all). - Any uncovered elements (empty if complete coverage is achieved).
§Arguments
others- The collection of items to coverself.f- A function that extracts a set from an item.
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.