pub trait CallExt {
// Required methods
fn has_flag(
&self,
engine_state: &EngineState,
stack: &mut Stack,
flag_name: &str,
) -> Result<bool, ShellError>;
fn get_flag<T: FromValue>(
&self,
engine_state: &EngineState,
stack: &mut Stack,
name: &str,
) -> Result<Option<T>, ShellError>;
fn get_flag_span(&self, stack: &Stack, name: &str) -> Option<Span>;
fn rest<T: FromValue>(
&self,
engine_state: &EngineState,
stack: &mut Stack,
starting_pos: usize,
) -> Result<Vec<T>, ShellError>;
fn opt<T: FromValue>(
&self,
engine_state: &EngineState,
stack: &mut Stack,
pos: usize,
) -> Result<Option<T>, ShellError>;
fn opt_const<T: FromValue>(
&self,
working_set: &StateWorkingSet<'_>,
pos: usize,
) -> Result<Option<T>, ShellError>;
fn req<T: FromValue>(
&self,
engine_state: &EngineState,
stack: &mut Stack,
pos: usize,
) -> Result<T, ShellError>;
fn req_parser_info<T: FromValue>(
&self,
engine_state: &EngineState,
stack: &mut Stack,
name: &str,
) -> Result<T, ShellError>;
fn has_positional_args(&self, stack: &Stack, starting_pos: usize) -> bool;
}
Required Methods§
Sourcefn has_flag(
&self,
engine_state: &EngineState,
stack: &mut Stack,
flag_name: &str,
) -> Result<bool, ShellError>
fn has_flag( &self, engine_state: &EngineState, stack: &mut Stack, flag_name: &str, ) -> Result<bool, ShellError>
Check if a boolean flag is set (i.e. --bool
or --bool=true
)
fn get_flag<T: FromValue>( &self, engine_state: &EngineState, stack: &mut Stack, name: &str, ) -> Result<Option<T>, ShellError>
Sourcefn get_flag_span(&self, stack: &Stack, name: &str) -> Option<Span>
fn get_flag_span(&self, stack: &Stack, name: &str) -> Option<Span>
Efficiently get the span of a flag argument
fn rest<T: FromValue>( &self, engine_state: &EngineState, stack: &mut Stack, starting_pos: usize, ) -> Result<Vec<T>, ShellError>
fn opt<T: FromValue>( &self, engine_state: &EngineState, stack: &mut Stack, pos: usize, ) -> Result<Option<T>, ShellError>
fn opt_const<T: FromValue>( &self, working_set: &StateWorkingSet<'_>, pos: usize, ) -> Result<Option<T>, ShellError>
fn req<T: FromValue>( &self, engine_state: &EngineState, stack: &mut Stack, pos: usize, ) -> Result<T, ShellError>
fn req_parser_info<T: FromValue>( &self, engine_state: &EngineState, stack: &mut Stack, name: &str, ) -> Result<T, ShellError>
Sourcefn has_positional_args(&self, stack: &Stack, starting_pos: usize) -> bool
fn has_positional_args(&self, stack: &Stack, starting_pos: usize) -> bool
True if the command has any positional or rest arguments, excluding before the given index.
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.