Trait nu_protocol::eval_base::Eval
source · pub trait Eval {
type State<'a>: Copy;
type MutState;
Show 13 methods
// Required methods
fn get_config<'a>(
state: Self::State<'a>,
mut_state: &mut Self::MutState
) -> Cow<'a, Config>;
fn eval_filepath(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
path: String,
quoted: bool,
span: Span
) -> Result<Value, ShellError>;
fn eval_directory(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
path: String,
quoted: bool,
span: Span
) -> Result<Value, ShellError>;
fn eval_var(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
var_id: VarId,
span: Span
) -> Result<Value, ShellError>;
fn eval_call(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
call: &Call,
span: Span
) -> Result<Value, ShellError>;
fn eval_external_call(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
head: &Expression,
args: &[ExternalArgument],
is_subexpression: bool,
span: Span
) -> Result<Value, ShellError>;
fn eval_subexpression(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
block_id: usize,
span: Span
) -> Result<Value, ShellError>;
fn regex_match(
state: Self::State<'_>,
op_span: Span,
lhs: &Value,
rhs: &Value,
invert: bool,
expr_span: Span
) -> Result<Value, ShellError>;
fn eval_assignment(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
lhs: &Expression,
rhs: &Expression,
assignment: Assignment,
op_span: Span,
expr_span: Span
) -> Result<Value, ShellError>;
fn eval_row_condition_or_closure(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
block_id: usize,
span: Span
) -> Result<Value, ShellError>;
fn eval_overlay(
state: Self::State<'_>,
span: Span
) -> Result<Value, ShellError>;
fn unreachable(expr: &Expression) -> Result<Value, ShellError>;
// Provided method
fn eval(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
expr: &Expression
) -> Result<Value, ShellError> { ... }
}Expand description
To share implementations for regular eval and const eval
Required Associated Types§
Required Methods§
fn get_config<'a>( state: Self::State<'a>, mut_state: &mut Self::MutState ) -> Cow<'a, Config>
fn eval_filepath( state: Self::State<'_>, mut_state: &mut Self::MutState, path: String, quoted: bool, span: Span ) -> Result<Value, ShellError>
fn eval_directory( state: Self::State<'_>, mut_state: &mut Self::MutState, path: String, quoted: bool, span: Span ) -> Result<Value, ShellError>
fn eval_var( state: Self::State<'_>, mut_state: &mut Self::MutState, var_id: VarId, span: Span ) -> Result<Value, ShellError>
fn eval_call( state: Self::State<'_>, mut_state: &mut Self::MutState, call: &Call, span: Span ) -> Result<Value, ShellError>
fn eval_external_call( state: Self::State<'_>, mut_state: &mut Self::MutState, head: &Expression, args: &[ExternalArgument], is_subexpression: bool, span: Span ) -> Result<Value, ShellError>
fn eval_subexpression( state: Self::State<'_>, mut_state: &mut Self::MutState, block_id: usize, span: Span ) -> Result<Value, ShellError>
fn regex_match( state: Self::State<'_>, op_span: Span, lhs: &Value, rhs: &Value, invert: bool, expr_span: Span ) -> Result<Value, ShellError>
fn eval_assignment( state: Self::State<'_>, mut_state: &mut Self::MutState, lhs: &Expression, rhs: &Expression, assignment: Assignment, op_span: Span, expr_span: Span ) -> Result<Value, ShellError>
fn eval_row_condition_or_closure( state: Self::State<'_>, mut_state: &mut Self::MutState, block_id: usize, span: Span ) -> Result<Value, ShellError>
fn eval_overlay(state: Self::State<'_>, span: Span) -> Result<Value, ShellError>
sourcefn unreachable(expr: &Expression) -> Result<Value, ShellError>
fn unreachable(expr: &Expression) -> Result<Value, ShellError>
For expressions that should never actually be evaluated
Provided Methods§
fn eval( state: Self::State<'_>, mut_state: &mut Self::MutState, expr: &Expression ) -> Result<Value, ShellError>
Object Safety§
This trait is not object safe.