Skip to main content

ContextBarSegment

Struct ContextBarSegment 

Source
pub struct ContextBarSegment { /* private fields */ }

Implementations§

Source§

impl ContextBarSegment

Source

pub fn from_extras( extras: &BTreeMap<String, Value>, warn: &mut impl FnMut(&str), ) -> Self

Parse the [segments.context_bar] extras bag. Unknown values warn and fall back to defaults. Thresholds are parsed as a pair and validated together — supplying a monotonic pair like green = 90, yellow = 95 is accepted regardless of declaration order, and the whole pair is rejected (with the bad fields warned individually) if any field is out of range or the pair inverts the ramp.

Trait Implementations§

Source§

impl Default for ContextBarSegment

Source§

fn default() -> ContextBarSegment

Returns the “default value” for a type. Read more
Source§

impl Segment for ContextBarSegment

Source§

fn render(&self, ctx: &DataContext, _rc: &RenderContext) -> RenderResult

Render this segment for the given context. Read more
Source§

fn defaults(&self) -> SegmentDefaults

Layout defaults (priority, width bounds, truncatable opt-in). User config may override each field via OverriddenSegment. Implementations must be O(1), do no I/O, and avoid allocation: the layout engine snapshots this at collect time and the [LineItem::Debug] impl reads it for dbg! / panic-backtrace formatting.
Source§

fn shrink_to_fit( &self, ctx: &DataContext, rc: &RenderContext, target: u16, ) -> Option<RenderedSegment>

Layout-pressure-aware compaction hook. The reflow loop calls this on any segment under width pressure (truncatable or not), asking whether it can produce a render at most target cells wide. It runs before truncatable end-ellipsis truncation, so segment-side intelligence beats generic string clipping when both apply. Default returns None (no compact form available; engine falls through to truncatable or drop). Segments with structured tail content override to shed decoration while keeping the signal-bearing prefix. Read more
Source§

fn data_deps(&self) -> &'static [DataDep]

Declare which data sources this segment reads. The runtime computes the union across all enabled segments and lazy-fetches only those sources. Defaults to the stdin payload only; segments that read other sources must override. See docs/specs/data-fetching.md §Segment dependency declaration. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.