rust-imap/src/types/capabilities.rs
Jos van den Oever 4c94c87686 Clippy fixes
2018-09-12 19:31:26 +02:00

29 lines
695 B
Rust

// Note that none of these fields are *actually* 'static.
// Rather, they are tied to the lifetime of the `ZeroCopy` that contains this `Name`.
use std::collections::hash_set::Iter;
use std::collections::HashSet;
pub struct Capabilities(pub(crate) HashSet<&'static str>);
use std::borrow::Borrow;
use std::hash::Hash;
impl Capabilities {
pub fn has<S: ?Sized>(&self, s: &S) -> bool
where
for<'a> &'a str: Borrow<S>,
S: Hash + Eq,
{
self.0.contains(s)
}
pub fn iter(&self) -> Iter<&str> {
self.0.iter()
}
pub fn len(&self) -> usize {
self.0.len()
}
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
}