pub trait PluginExecutionContext: Send + Sync {
Show 15 methods
// Required methods
fn span(&self) -> Span;
fn signals(&self) -> &Signals;
fn pipeline_externals_state(&self) -> Option<&Arc<(AtomicU32, AtomicU32)>>;
fn get_config(&self) -> Result<Arc<Config>, ShellError>;
fn get_plugin_config(&self) -> Result<Option<Value>, ShellError>;
fn get_env_var(&self, name: &str) -> Result<Option<&Value>, ShellError>;
fn get_env_vars(&self) -> Result<HashMap<String, Value>, ShellError>;
fn get_current_dir(&self) -> Result<Spanned<String>, ShellError>;
fn add_env_var(
&mut self,
name: String,
value: Value,
) -> Result<(), ShellError>;
fn get_help(&self) -> Result<Spanned<String>, ShellError>;
fn get_span_contents(
&self,
span: Span,
) -> Result<Spanned<Vec<u8>>, ShellError>;
fn eval_closure(
&self,
closure: Spanned<Closure>,
positional: Vec<Value>,
input: PipelineData,
redirect_stdout: bool,
redirect_stderr: bool,
) -> Result<PipelineData, ShellError>;
fn find_decl(&self, name: &str) -> Result<Option<DeclId>, ShellError>;
fn call_decl(
&mut self,
decl_id: DeclId,
call: EvaluatedCall,
input: PipelineData,
redirect_stdout: bool,
redirect_stderr: bool,
) -> Result<PipelineData, ShellError>;
fn boxed(&self) -> Box<dyn PluginExecutionContext>;
}
Expand description
Object safe trait for abstracting operations required of the plugin context.
Required Methods§
Sourcefn pipeline_externals_state(&self) -> Option<&Arc<(AtomicU32, AtomicU32)>>
fn pipeline_externals_state(&self) -> Option<&Arc<(AtomicU32, AtomicU32)>>
The pipeline externals state, for tracking the foreground process group, if present
Sourcefn get_config(&self) -> Result<Arc<Config>, ShellError>
fn get_config(&self) -> Result<Arc<Config>, ShellError>
Get engine configuration
Sourcefn get_plugin_config(&self) -> Result<Option<Value>, ShellError>
fn get_plugin_config(&self) -> Result<Option<Value>, ShellError>
Get plugin configuration
Sourcefn get_env_var(&self, name: &str) -> Result<Option<&Value>, ShellError>
fn get_env_var(&self, name: &str) -> Result<Option<&Value>, ShellError>
Get an environment variable from $env
Sourcefn get_env_vars(&self) -> Result<HashMap<String, Value>, ShellError>
fn get_env_vars(&self) -> Result<HashMap<String, Value>, ShellError>
Get all environment variables
Sourcefn get_current_dir(&self) -> Result<Spanned<String>, ShellError>
fn get_current_dir(&self) -> Result<Spanned<String>, ShellError>
Get current working directory
Sourcefn add_env_var(&mut self, name: String, value: Value) -> Result<(), ShellError>
fn add_env_var(&mut self, name: String, value: Value) -> Result<(), ShellError>
Set an environment variable
Sourcefn get_span_contents(&self, span: Span) -> Result<Spanned<Vec<u8>>, ShellError>
fn get_span_contents(&self, span: Span) -> Result<Spanned<Vec<u8>>, ShellError>
Get the contents of a Span
Sourcefn eval_closure(
&self,
closure: Spanned<Closure>,
positional: Vec<Value>,
input: PipelineData,
redirect_stdout: bool,
redirect_stderr: bool,
) -> Result<PipelineData, ShellError>
fn eval_closure( &self, closure: Spanned<Closure>, positional: Vec<Value>, input: PipelineData, redirect_stdout: bool, redirect_stderr: bool, ) -> Result<PipelineData, ShellError>
Evaluate a closure passed to the plugin
Sourcefn find_decl(&self, name: &str) -> Result<Option<DeclId>, ShellError>
fn find_decl(&self, name: &str) -> Result<Option<DeclId>, ShellError>
Find a declaration by name
Sourcefn call_decl(
&mut self,
decl_id: DeclId,
call: EvaluatedCall,
input: PipelineData,
redirect_stdout: bool,
redirect_stderr: bool,
) -> Result<PipelineData, ShellError>
fn call_decl( &mut self, decl_id: DeclId, call: EvaluatedCall, input: PipelineData, redirect_stdout: bool, redirect_stderr: bool, ) -> Result<PipelineData, ShellError>
Call a declaration with arguments and input
Sourcefn boxed(&self) -> Box<dyn PluginExecutionContext>
fn boxed(&self) -> Box<dyn PluginExecutionContext>
Create an owned version of the context with 'static
lifetime