sudachi::plugin

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

Object Safety§

This trait is not object safe.

Implementors§