Skip to main content

ShapeModel

Trait ShapeModel 

Source
pub trait ShapeModel: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn prepare(&self, config: &Config) -> Result<Arc<dyn ShapeInstance>>;

    // Provided methods
    fn doc(&self) -> String { ... }
    fn params(&self) -> Vec<ParamSpec> { ... }
    fn example_config(&self) -> Option<Config> { ... }
    fn example_radius(&self) -> f64 { ... }
}
Expand description

利用者定義の形のモデル(設定から ShapeInstance を作る)

Required Methods§

Source

fn name(&self) -> &str

登録の名前

Source

fn prepare(&self, config: &Config) -> Result<Arc<dyn ShapeInstance>>

設定を確かめて形を作る(軽くする。最適化・公差では値を変えるたびに呼ぶ)

Provided Methods§

Source

fn doc(&self) -> String

1 行の説明

Source

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

設定の項目(GUI の欄・一覧用)

Source

fn example_config(&self) -> Option<Config>

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

Source

fn example_radius(&self) -> f64

試しの設定で確かめる半径 [mm](形が有効な半直径。既定 10)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§