pub struct BuildContext { /* private fields */ }Expand description
Shared build context passed to all runners.
Carries environment variables and a metrics handle that runners use during task construction.
Created once at router setup time and shared (by clone) across all Runner::build_task calls.
§Defaults
env: emptyRunnerEnvmetrics:NoOpMetrics(zero-cost)
§Also
RunnerRouter::with_contextsets the context for all runners.MetricsHandle-Arc<dyn MetricsBackend>.
Implementations§
Source§impl BuildContext
impl BuildContext
Sourcepub fn new(env: RunnerEnv, metrics: MetricsHandle) -> Self
pub fn new(env: RunnerEnv, metrics: MetricsHandle) -> Self
Create a new build context with the given params.
Sourcepub fn metrics(&self) -> &MetricsHandle
pub fn metrics(&self) -> &MetricsHandle
Get a clonable handle to the metrics backend.
Sourcepub fn with_env(self, env: RunnerEnv) -> Self
pub fn with_env(self, env: RunnerEnv) -> Self
Replace the environment and return updated context.
Sourcepub fn with_metrics(self, metrics: MetricsHandle) -> Self
pub fn with_metrics(self, metrics: MetricsHandle) -> Self
Replace the metrics backend and return updated context.
Trait Implementations§
Source§impl Clone for BuildContext
impl Clone for BuildContext
Source§fn clone(&self) -> BuildContext
fn clone(&self) -> BuildContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BuildContext
impl Debug for BuildContext
Source§impl Default for BuildContext
impl Default for BuildContext
Auto Trait Implementations§
impl Freeze for BuildContext
impl !RefUnwindSafe for BuildContext
impl Send for BuildContext
impl Sync for BuildContext
impl Unpin for BuildContext
impl UnsafeUnpin for BuildContext
impl !UnwindSafe for BuildContext
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