pub trait Eval {
type State<'a>: Copy + GetSpan;
type MutState;
Show 14 methods
// Required methods
fn get_config(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
) -> Arc<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<D: DebugContext>(
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],
span: Span,
) -> Result<Value, ShellError>;
fn eval_collect<D: DebugContext>(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
var_id: VarId,
expr: &Expression,
) -> Result<Value, ShellError>;
fn eval_subexpression<D: DebugContext>(
state: Self::State<'_>,
mut_state: &mut Self::MutState,
block_id: BlockId,
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<D: DebugContext>(
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: BlockId,
span: Span,
) -> Result<Value, ShellError>;
fn eval_overlay(
state: Self::State<'_>,
span: Span,
) -> Result<Value, ShellError>;
fn unreachable(
state: Self::State<'_>,
expr: &Expression,
) -> Result<Value, ShellError>;
// Provided method
fn eval<D: DebugContext>(
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( state: Self::State<'_>, mut_state: &mut Self::MutState, ) -> Arc<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<D: DebugContext>( 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], span: Span, ) -> Result<Value, ShellError>
fn eval_collect<D: DebugContext>( state: Self::State<'_>, mut_state: &mut Self::MutState, var_id: VarId, expr: &Expression, ) -> Result<Value, ShellError>
fn eval_subexpression<D: DebugContext>( state: Self::State<'_>, mut_state: &mut Self::MutState, block_id: BlockId, 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<D: DebugContext>( 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: BlockId, span: Span, ) -> Result<Value, ShellError>
fn eval_overlay(state: Self::State<'_>, span: Span) -> Result<Value, ShellError>
Sourcefn unreachable(
state: Self::State<'_>,
expr: &Expression,
) -> Result<Value, ShellError>
fn unreachable( state: Self::State<'_>, expr: &Expression, ) -> Result<Value, ShellError>
For expressions that should never actually be evaluated
Provided Methods§
fn eval<D: DebugContext>( state: Self::State<'_>, mut_state: &mut Self::MutState, expr: &Expression, ) -> Result<Value, ShellError>
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.