Skip to main content

Engine

Trait Engine 

Source
pub trait Engine: Segmenter + Sized {
    type Config;

    const NAME: &'static str;
    const MODEL: &'static [ModelDownload];

    // Required methods
    fn check_from(config: &Self::Config) -> Result<PathBuf, SegmentationError>;
    fn load_from(config: Self::Config) -> Result<Self, SegmentationError>;
}
Expand description

How an engine is constructed from its own configuration. Implementing this beside Segmenter is the whole checklist for a new engine.

Required Associated Constants§

Source

const NAME: &'static str

Source

const MODEL: &'static [ModelDownload]

The files to download for this engine, all into one folder. Empty when nothing is downloaded for it. An engine that reads a second folder lists that folder’s files in a const of its own.

Required Associated Types§

Required Methods§

Source

fn check_from(config: &Self::Config) -> Result<PathBuf, SegmentationError>

Resolves what a load would read, without reading it.

Source

fn load_from(config: Self::Config) -> Result<Self, SegmentationError>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§