#[non_exhaustive]pub struct RenderedSegment { /* private fields */ }Expand description
Output of a successful segment render.
Fields are pub(crate) so the engine can read them directly;
external callers go through the constructors and accessors so the
width == text_width(text) invariant can’t desync via a mutable
text. #[non_exhaustive] keeps future additions SemVer-safe.
Implementations§
Source§impl RenderedSegment
impl RenderedSegment
Sourcepub fn new(text: impl Into<String>) -> Self
pub fn new(text: impl Into<String>) -> Self
Build a rendered segment from text, auto-computing its cell
width. Use Self::with_separator when the segment wants to
override its default right-separator for this boundary, and
Self::with_role / Self::with_style to attach a theme
role or full style.
pub fn with_separator(text: impl Into<String>, separator: Separator) -> Self
Sourcepub fn with_role(self, role: Role) -> Self
pub fn with_role(self, role: Role) -> Self
Chainable setter for the segment’s theme role. The layout
engine resolves the role against the active theme + terminal
capability at render time; no ANSI bytes land in text.
Preserves any decorations previously set by Self::with_style.
Pair with with_style carefully: .with_style(s).with_role(r)
keeps s’s bold/fg/etc. and swaps role, whereas
.with_role(r).with_style(s) wholesale-replaces everything.
Sourcepub fn with_style(self, style: Style) -> Self
pub fn with_style(self, style: Style) -> Self
Chainable setter for the full style (role + decorations).
Wholesale-replaces the current style; use Self::with_role
when you want to preserve decorations and swap only the role.
Sourcepub fn right_separator(&self) -> Option<&Separator>
pub fn right_separator(&self) -> Option<&Separator>
Separator this render prefers on its right edge, if any. None
means “fall back to the segment’s default separator.”
Trait Implementations§
Source§impl Clone for RenderedSegment
impl Clone for RenderedSegment
Source§fn clone(&self) -> RenderedSegment
fn clone(&self) -> RenderedSegment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RenderedSegment
impl Debug for RenderedSegment
Source§impl PartialEq for RenderedSegment
impl PartialEq for RenderedSegment
Source§fn eq(&self, other: &RenderedSegment) -> bool
fn eq(&self, other: &RenderedSegment) -> bool
self and other values to be equal, and is used by ==.impl Eq for RenderedSegment
impl StructuralPartialEq for RenderedSegment
Auto Trait Implementations§
impl Freeze for RenderedSegment
impl RefUnwindSafe for RenderedSegment
impl Send for RenderedSegment
impl Sync for RenderedSegment
impl Unpin for RenderedSegment
impl UnsafeUnpin for RenderedSegment
impl UnwindSafe for RenderedSegment
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.