use super::Collection;
use std::fmt::Debug;
pub trait CollectionPattern<C>
where
C: Collection,
{
fn matches(&self, collection: &C) -> bool;
fn display(&self) -> String;
}
impl<C> CollectionPattern<C> for C::Item
where
C: Collection,
C::Item: Debug,
{
fn matches(&self, collection: &C) -> bool {
collection.contains(&self)
}
fn display(&self) -> String {
format!("{:?}", self)
}
}