#[non_exhaustive]pub struct RunContext<'a> {
pub theme: &'a Theme,
pub capability: Capability,
pub terminal_width: u16,
pub cwd: Option<PathBuf>,
pub hyperlinks: bool,
}Expand description
CLI run-state bundle: theme + capability + terminal width + cwd.
Passed to run_with_context; the CLI driver builds one from
config (theme name), the color-policy precedence chain (CLI flags /
env / config), CliEnv.terminal_width minus any padding, and the
process cwd. Distinct from
segments::RenderContext, which
is the per-segment-render layout state.
cwd seeds gix repo discovery. None skips discovery entirely;
Some(path) runs gix::discover(path) on the first ctx.git()
read.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.theme: &'a Theme§capability: Capability§terminal_width: u16§cwd: Option<PathBuf>§hyperlinks: boolWhether the terminal advertises OSC 8 hyperlink support. Drives
emission of Style.hyperlink URLs in layout::runs_to_ansi;
orthogonal to color capability since hyperlinks and color
support are independent terminal features.
Implementations§
Source§impl<'a> RunContext<'a>
impl<'a> RunContext<'a>
Sourcepub fn new(
theme: &'a Theme,
capability: Capability,
terminal_width: u16,
cwd: Option<PathBuf>,
hyperlinks: bool,
) -> Self
pub fn new( theme: &'a Theme, capability: Capability, terminal_width: u16, cwd: Option<PathBuf>, hyperlinks: bool, ) -> Self
Build a RunContext. The struct is #[non_exhaustive] so
struct-literal construction is blocked downstream; benches,
out-of-tree embedders, and in-crate call sites all go through
this constructor so future field additions touch one site.
terminal_width is forwarded as-is. The layout engine treats
0 as “no budget” and drops every droppable segment; callers
that want a default should use detect_terminal_width or
DEFAULT_TERMINAL_WIDTH instead of relying on the sentinel.
Trait Implementations§
Source§impl<'a> Clone for RunContext<'a>
impl<'a> Clone for RunContext<'a>
Source§fn clone(&self) -> RunContext<'a>
fn clone(&self) -> RunContext<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more