Skip to main content

SourceModel

Trait SourceModel 

Source
pub trait SourceModel: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn prepare(
        &self,
        config: &BTreeMap<String, Value>,
    ) -> Result<Arc<dyn SourceInstance>, Error>;

    // Provided methods
    fn doc(&self) -> String { ... }
    fn params(&self) -> Vec<ParamSpec> { ... }
    fn example_config(&self) -> Option<BTreeMap<String, Value>> { ... }
}
Expand description

光源のモデル

Required Methods§

Source

fn name(&self) -> &str

登録の名前

Source

fn prepare( &self, config: &BTreeMap<String, Value>, ) -> Result<Arc<dyn SourceInstance>, Error>

設定を確かめて光源を作る

Provided Methods§

Source

fn doc(&self) -> String

1 行の説明

Source

fn params(&self) -> Vec<ParamSpec>

設定の項目(一覧用)

Source

fn example_config(&self) -> Option<BTreeMap<String, Value>>

試しの設定(拡張の検査で check_source に渡す)。既定は SourceModel::params の既定値を並べたもの (既定値の無い項目があれば None。そのときは自分で返す)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§