pub struct Context {
pub config: Config,
pub workspace_root: PathBuf,
pub target_dir: PathBuf,
pub executable: PathBuf,
pub is_test: bool,
pub cache_dir: PathBuf,
pub output_dir: PathBuf,
pub template_vars: HashMap<String, String>,
}Expand description
Context object that carries state through the build pipeline.
Fields§
§config: ConfigConfiguration.
workspace_root: PathBufWorkspace root directory.
target_dir: PathBufTarget directory for build artifacts.
executable: PathBufPath to the executable being run.
is_test: boolWhether this is a test run.
cache_dir: PathBufCache directory for downloaded/generated files.
output_dir: PathBufOutput directory for the current build.
template_vars: HashMap<String, String>Template variables available for substitution.
Implementations§
Source§impl Context
impl Context
Sourcepub fn new(
config: Config,
workspace_root: PathBuf,
executable: PathBuf,
) -> Result<Self>
pub fn new( config: Config, workspace_root: PathBuf, executable: PathBuf, ) -> Result<Self>
Create a new context from configuration and executable path.
Sourcepub fn detect_test(&mut self)
pub fn detect_test(&mut self)
Detect if the executable is a test binary.
Tests are detected by checking if the executable name ends with a hash (Cargo appends a hash suffix to test binaries).
Sourcepub fn get_extra_args(&self) -> &[String]
pub fn get_extra_args(&self) -> &[String]
Get the appropriate extra arguments based on whether this is a test run.
Sourcepub fn test_success_exit_code(&self) -> Option<i32>
pub fn test_success_exit_code(&self) -> Option<i32>
Get the success exit code for tests, if configured.
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe 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