Trait PluginCategory

Source
pub trait PluginCategory {
    type BoxType;
    type InitFnType;

    // Required methods
    fn configurations(cfg: &Config) -> &[Value];
    fn bundled_impl(name: &str) -> Option<Self::BoxType>;
    fn do_setup(
        ptr: &mut Self::BoxType,
        settings: &Value,
        config: &Config,
        grammar: &mut Grammar<'_>,
    ) -> SudachiResult<()>;
}
Expand description

A category of Plugins

Required Associated Types§

Source

type BoxType

Boxed type of the plugin. Should be Box.

Source

type InitFnType

Type of the initialization function. It must take 0 arguments and return SudachiResult<Self::BoxType>.

Required Methods§

Source

fn configurations(cfg: &Config) -> &[Value]

Extract plugin configurations from the config

Source

fn bundled_impl(name: &str) -> Option<Self::BoxType>

Create bundled plugin for plugin name Instead of full name like com.worksap.nlp.sudachi.ProlongedSoundMarkPlugin should handle only the short one: ProlongedSoundMarkPlugin

com.worksap.nlp.sudachi. (last dot included) will be stripped automatically by the loader code

Source

fn do_setup( ptr: &mut Self::BoxType, settings: &Value, config: &Config, grammar: &mut Grammar<'_>, ) -> SudachiResult<()>

Perform initial setup. We can’t call set_up of the plugin directly in the default implementation of this method because we do not know the specific type yet

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.

Implementors§