Trait ScriptEvaluator

Source
pub trait ScriptEvaluator {
    type Shared<'a>;
    type VariableStore: VariableStore;

    // Required methods
    fn get_variable_store<'a>(
        &self,
        shared: &'a mut Self::Shared<'_>,
    ) -> &'a mut Self::VariableStore;
    fn eval_condition(
        &mut self,
        shared: &mut Self::Shared<'_>,
        condition: &ConditionKind,
    ) -> Result<bool>;
    fn add_dependency(
        &mut self,
        shared: &mut Self::Shared<'_>,
        dep: Vec<RequiredPackage>,
    ) -> Result<()>;
    fn add_conflict(
        &mut self,
        shared: &mut Self::Shared<'_>,
        pkg: PackageID,
    ) -> Result<()>;
    fn add_recommendation(
        &mut self,
        shared: &mut Self::Shared<'_>,
        pkg: RecommendedPackage,
    ) -> Result<()>;
    fn add_bundled(
        &mut self,
        shared: &mut Self::Shared<'_>,
        pkg: PackageID,
    ) -> Result<()>;
    fn add_compat(
        &mut self,
        shared: &mut Self::Shared<'_>,
        compat: (PackageID, PackageID),
    ) -> Result<()>;
    fn add_extension(
        &mut self,
        shared: &mut Self::Shared<'_>,
        pkg: PackageID,
    ) -> Result<()>;
    fn add_notice(
        &mut self,
        shared: &mut Self::Shared<'_>,
        notice: String,
    ) -> Result<()>;
    fn add_command(
        &mut self,
        shared: &mut Self::Shared<'_>,
        command: Vec<String>,
    ) -> Result<()>;
    fn add_addon(
        &mut self,
        shared: &mut Self::Shared<'_>,
        addon: AddonInstructionData,
    ) -> Result<()>;
    fn run_custom(
        &mut self,
        shared: &mut Self::Shared<'_>,
        command: String,
        args: Vec<String>,
    ) -> Result<()>;
}
Expand description

A trait for a type that has specific implementations of package script evaluation functions

Required Associated Types§

Source

type Shared<'a>

The shared evaluation state to provide to methods

Source

type VariableStore: VariableStore

The type of variable store to use

Required Methods§

Source

fn get_variable_store<'a>( &self, shared: &'a mut Self::Shared<'_>, ) -> &'a mut Self::VariableStore

Get the evaluator’s variable store from the shared data

Source

fn eval_condition( &mut self, shared: &mut Self::Shared<'_>, condition: &ConditionKind, ) -> Result<bool>

Evaluate a condition

Source

fn add_dependency( &mut self, shared: &mut Self::Shared<'_>, dep: Vec<RequiredPackage>, ) -> Result<()>

Add a dependency

Source

fn add_conflict( &mut self, shared: &mut Self::Shared<'_>, pkg: PackageID, ) -> Result<()>

Add a conflict

Source

fn add_recommendation( &mut self, shared: &mut Self::Shared<'_>, pkg: RecommendedPackage, ) -> Result<()>

Add a recommendation

Source

fn add_bundled( &mut self, shared: &mut Self::Shared<'_>, pkg: PackageID, ) -> Result<()>

Add a bundled package

Source

fn add_compat( &mut self, shared: &mut Self::Shared<'_>, compat: (PackageID, PackageID), ) -> Result<()>

Add a compat

Source

fn add_extension( &mut self, shared: &mut Self::Shared<'_>, pkg: PackageID, ) -> Result<()>

Add an extension

Source

fn add_notice( &mut self, shared: &mut Self::Shared<'_>, notice: String, ) -> Result<()>

Add a notice

Source

fn add_command( &mut self, shared: &mut Self::Shared<'_>, command: Vec<String>, ) -> Result<()>

Add a command

Source

fn add_addon( &mut self, shared: &mut Self::Shared<'_>, addon: AddonInstructionData, ) -> Result<()>

Add an addon

Source

fn run_custom( &mut self, shared: &mut Self::Shared<'_>, command: String, args: Vec<String>, ) -> Result<()>

Run a custom instruction

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§