[][src]Struct dqcsim::common::converter::ConverterMap

pub struct ConverterMap<'c, K, I, O> where
    K: Eq + Hash + Clone,
    I: Eq + Hash + Clone,
    O: Clone
{ /* fields omitted */ }

K: user-defined key for identifying which converter to use I: detector input = constructor output O: detector output = constructor input

Implementations

impl<'c, K, I, O> ConverterMap<'c, K, I, O> where
    K: Eq + Hash + Clone,
    I: Eq + Hash + Clone,
    O: Clone
[src]

pub fn new(cache_key_generator: Option<Box<dyn Fn(&I) -> I>>) -> Self[src]

Constructs a new empty ConverterMap.

pub fn push(
    &mut self,
    key: impl Into<K>,
    converter: Box<dyn Converter<Input = I, Output = O> + 'c>
)
[src]

Appends a Converter with the specified key to the back of the collection of Detectors in this map.

pub fn insert(
    &mut self,
    index: usize,
    key: impl Into<K>,
    converter: Box<dyn Converter<Input = I, Output = O> + 'c>
)
[src]

Inserts a Converter at position index within the collection of Detectors in this map, with the specified key associated to the inserted Converter.

pub fn with(
    self,
    key: impl Into<K>,
    converter: Box<dyn Converter<Input = I, Output = O> + 'c>
) -> Self
[src]

Appends the specified Converter with the corresponding specified key to the collection and returns the updated DetectorMap.

pub fn clear_cache(&self)[src]

Clears the cache.

pub fn len(&self) -> usize[src]

Returns the number of Detectors in the collection.

pub fn is_empty(&self) -> bool[src]

Returns true if the collection contains no Detectors.

Trait Implementations

impl<'c, I, K, O> Converter for ConverterMap<'c, K, I, O> where
    K: Eq + Hash + Clone,
    I: Eq + Hash + Clone,
    O: Clone
[src]

type Input = I

The more generic detector input type = constructor output type.

type Output = (K, O)

The more specific detector output type = constructor input type.

impl<'c, K, I, O> Default for ConverterMap<'c, K, I, O> where
    K: Eq + Hash + Clone,
    I: Eq + Hash + Clone,
    O: Clone
[src]

Auto Trait Implementations

impl<'c, K, I, O> !RefUnwindSafe for ConverterMap<'c, K, I, O>

impl<'c, K, I, O> !Send for ConverterMap<'c, K, I, O>

impl<'c, K, I, O> !Sync for ConverterMap<'c, K, I, O>

impl<'c, K, I, O> Unpin for ConverterMap<'c, K, I, O> where
    I: Unpin,
    K: Unpin,
    O: Unpin

impl<'c, K, I, O> !UnwindSafe for ConverterMap<'c, K, I, O>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,