pub struct Context { /* private fields */ }Expand description
Execution state shared by a chain of tasks and their nested calls.
A context is synchronous and confined to its caller. No global current directory or environment changes are needed for task execution.
Implementations§
Source§impl Context
impl Context
pub fn root(&self) -> &Path
pub fn previous(&self) -> &Value
Sourcepub fn write_output(&mut self, output: &str)
pub fn write_output(&mut self, output: &str)
Add user-facing output to the command result. Task diagnostics should use stderr.
pub fn insert<State: Any>(&mut self, state: State)
pub fn get<State: Any>(&self) -> Option<&State>
pub fn get_mut<State: Any>(&mut self) -> Option<&mut State>
Sourcepub fn command(&self, program: impl AsRef<OsStr>) -> Command
pub fn command(&self, program: impl AsRef<OsStr>) -> Command
Start a process in the project root. Arguments go directly to the process; shell parsing is only used if a task explicitly invokes a shell.
Auto Trait Implementations§
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl !UnwindSafe for Context
impl Freeze for Context
impl Unpin for Context
impl UnsafeUnpin for Context
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