trs_dataframe::candidate

Trait CandidateData

Source
pub trait CandidateData:
    Default
    + Clone
    + Debug
    + Default
    + IntoIterator<Item = (Key, DataValue)>
    + Send
    + Sync
    + 'static {
    // Required methods
    fn get_value(&self, key: &Key) -> Result<DataValue, Error>;
    fn get_value_ref(&self, key: &Key) -> Option<&DataValue>;
    fn store_value(&mut self, key: &Key, value: DataValue) -> Option<DataValue>;
    fn merge(&mut self, other: &Self);
    fn keys(&self) -> Vec<Key>;
    fn select(&self, keys: &[Key]) -> Vec<DataValue>;
    fn remove(&mut self, key: &Key) -> Option<DataValue>;
}
Expand description

Basic trait for the work with the candidate data This trait is used to store and retrive the data for the candidates

Required Methods§

Source

fn get_value(&self, key: &Key) -> Result<DataValue, Error>

Get the value for the key Key

Source

fn get_value_ref(&self, key: &Key) -> Option<&DataValue>

Source

fn store_value(&mut self, key: &Key, value: DataValue) -> Option<DataValue>

Store the value DataValue for the key Key and return the old value if any

Source

fn merge(&mut self, other: &Self)

Merge the data from the other candidate

Source

fn keys(&self) -> Vec<Key>

Get the keys for the candidate

Source

fn select(&self, keys: &[Key]) -> Vec<DataValue>

Select the values for the keys

Source

fn remove(&mut self, key: &Key) -> Option<DataValue>

Remove data from the candidate

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.

Implementations on Foreign Types§

Source§

impl CandidateData for HashMap<Key, DataValue>

Source§

fn get_value(&self, key: &Key) -> Result<DataValue, Error>

Source§

fn get_value_ref(&self, key: &Key) -> Option<&DataValue>

Source§

fn store_value(&mut self, key: &Key, value: DataValue) -> Option<DataValue>

Source§

fn merge(&mut self, other: &Self)

Source§

fn keys(&self) -> Vec<Key>

Source§

fn select(&self, keys: &[Key]) -> Vec<DataValue>

Source§

fn remove(&mut self, key: &Key) -> Option<DataValue>

Source§

impl CandidateData for HashMap<Key, DataValue>

Source§

fn get_value(&self, key: &Key) -> Result<DataValue, Error>

Source§

fn get_value_ref(&self, key: &Key) -> Option<&DataValue>

Source§

fn store_value(&mut self, key: &Key, value: DataValue) -> Option<DataValue>

Source§

fn merge(&mut self, other: &Self)

Source§

fn keys(&self) -> Vec<Key>

Source§

fn select(&self, keys: &[Key]) -> Vec<DataValue>

Source§

fn remove(&mut self, key: &Key) -> Option<DataValue>

Implementors§