pub struct ScriptManager { /* private fields */ }
Expand description

ScriptManager holds all the scripts found, it can be constructed with ScriptManager::default
Initially its empty, to populate it, we can use one of the methods to add scripts, currently only ScriptManager::add_scripts_by_path is provided

Implementations

Look for scripts in the specified folder
It requires specifying a VersionReq so the script manager can check for incompatibility and if that’s the case it will return an error: Error::ScriptVersionMismatch

let mut sm = ScriptManager::default();
let scripts_path: std::path::PathBuf = todo!(); // Defined by the user
const VERSION: &'static str = concat!("main_crate-", env!("CARGO_PKG_VERSION"));
sm.add_scripts_by_path(scripts_path, Version::parse(VERSION).expect("version is correct"));

Trigger a hook All scripts that are active and that are listening for this particular hook will receive it

List of current scripts

Mutable list of current scripts, useful for activating/deactivating a script

Trait Implementations

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.