Trait synthez::field::Container

source ·
pub trait Container<V> {
    type Value;

    // Required methods
    fn is_empty(&self) -> bool;
    fn has(&self, value: &V) -> bool;
    fn replace(&mut self, value: V) -> Option<V>;

    // Provided method
    fn set(&mut self, value: V) { ... }
}
Expand description

Container containing field values.

Required Associated Types§

source

type Value

Type of values contained in this Container.

Required Methods§

source

fn is_empty(&self) -> bool

Indicates whether this Container is empty (contains no values).

source

fn has(&self, value: &V) -> bool

Indicates whether the provided value is present in this Container.

source

fn replace(&mut self, value: V) -> Option<V>

Replaces the value contained in this Container with the provided one, and returns the replaced one, if any.

Provided Methods§

source

fn set(&mut self, value: V)

Sets the provided value into this Container, dropping the previous one, if any.

Implementations on Foreign Types§

source§

impl<K, V> Container<(K, V)> for BTreeMap<K, V, Global>where K: Ord,

§

type Value = (K, V)

source§

fn is_empty(&self) -> bool

source§

fn has(&self, val: &(K, V)) -> bool

source§

fn replace(&mut self, val: (K, V)) -> Option<(K, V)>

source§

impl<K, V, S> Container<(K, V)> for HashMap<K, V, S>where K: Eq + Hash, S: BuildHasher,

§

type Value = (K, V)

source§

fn is_empty(&self) -> bool

source§

fn has(&self, val: &(K, V)) -> bool

source§

fn replace(&mut self, val: (K, V)) -> Option<(K, V)>

source§

impl<V> Container<V> for Vec<V, Global>where V: PartialEq<V>,

§

type Value = V

source§

fn is_empty(&self) -> bool

source§

fn has(&self, val: &V) -> bool

source§

fn replace(&mut self, val: V) -> Option<V>

source§

impl<V> Container<V> for Option<V>

§

type Value = V

source§

fn is_empty(&self) -> bool

source§

fn has(&self, _: &V) -> bool

source§

fn replace(&mut self, val: V) -> Option<V>

source§

impl<V> Container<V> for BTreeSet<V, Global>where V: Ord,

§

type Value = V

source§

fn is_empty(&self) -> bool

source§

fn has(&self, val: &V) -> bool

source§

fn replace(&mut self, val: V) -> Option<V>

source§

impl<V, S> Container<V> for HashSet<V, S>where V: Eq + Hash, S: BuildHasher,

§

type Value = V

source§

fn is_empty(&self) -> bool

source§

fn has(&self, val: &V) -> bool

source§

fn replace(&mut self, val: V) -> Option<V>

Implementors§

source§

impl<V> Container<V> for Required<V>

§

type Value = V