pub struct Context<'a> { /* private fields */ }Expand description
Execution context handed to every middleware.
Implementations§
Source§impl<'a> Context<'a>
impl<'a> Context<'a>
pub fn new(host: &'a dyn Host, working_dir: String, step_name: String) -> Self
pub fn with_state(self, state: &'a dyn Any) -> Self
pub fn with_plugin_config(self, cfg: &'a dyn Any) -> Self
pub fn log_debug(&self, msg: &str)
pub fn log_info(&self, msg: &str)
pub fn log_warn(&self, msg: &str)
pub fn log_error(&self, msg: &str)
pub fn progress(&self, msg: &str)
pub fn working_dir(&self) -> &str
pub fn step_name(&self) -> &str
Sourcepub fn get_config(&self, path: &str) -> Option<Value>
pub fn get_config(&self, path: &str) -> Option<Value>
Raw accumulated config at path (:-separated), parsed from json-value.
Sourcepub fn get_config_as<T: DeserializeOwned>(&self, path: &str) -> Option<T>
pub fn get_config_as<T: DeserializeOwned>(&self, path: &str) -> Option<T>
Config at path, coerced (§5.4) into T. None if absent or on error.
Sourcepub fn command(&self, program: impl Into<String>) -> Command<'a>
pub fn command(&self, program: impl Into<String>) -> Command<'a>
Subprocess builder for program.
Sourcepub fn state<T: 'static>(&self) -> &T
pub fn state<T: 'static>(&self) -> &T
The plugin’s shared state. Panics if the plugin declared no state:.
Sourcepub fn plugin_config<T: 'static>(&self) -> &T
pub fn plugin_config<T: 'static>(&self) -> &T
The typed plugin-level config. Panics if the plugin declared no config:.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Context<'a>
impl<'a> !Send for Context<'a>
impl<'a> !Sync for Context<'a>
impl<'a> !UnwindSafe for Context<'a>
impl<'a> Freeze for Context<'a>
impl<'a> Unpin for Context<'a>
impl<'a> UnsafeUnpin for Context<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more