Skip to main content

DataSource

Trait DataSource 

Source
pub trait DataSource {
    // Required methods
    fn names(&self) -> Vec<Spur>;
    fn take_set(
        &mut self,
        decl: &Set,
        dimen: usize,
    ) -> Result<Option<HashMap<SmallVec<[SetVal; 6]>, SetVals>>>;
    fn take_param(&mut self, decl: &Param) -> Result<Option<ParamValues>>;
}
Expand description

Provides set and param data to a model.

The compiler asks for each declared set and param in turn, passing the declaration (needed to interpret the data), and takes ownership of what’s returned.

Required Methods§

Source

fn names(&self) -> Vec<Spur>

Names of all sets and params with data, so undeclared data can be rejected

Source

fn take_set( &mut self, decl: &Set, dimen: usize, ) -> Result<Option<HashMap<SmallVec<[SetVal; 6]>, SetVals>>>

Source

fn take_param(&mut self, decl: &Param) -> Result<Option<ParamValues>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: DataSource + ?Sized> DataSource for Box<T>

Source§

fn names(&self) -> Vec<Spur>

Source§

fn take_set( &mut self, decl: &Set, dimen: usize, ) -> Result<Option<HashMap<SmallVec<[SetVal; 6]>, SetVals>>>

Source§

fn take_param(&mut self, decl: &Param) -> Result<Option<ParamValues>>

Implementors§