pub struct Rule {
pub title: Option<Text>,
pub characters: String,
pub style: Style,
pub end: String,
pub align: HorizontalAlign,
}Expand description
A horizontal rule (line) with optional centered, left-, or right-aligned title.
Fields§
§title: Option<Text>Optional title text displayed within the rule.
characters: StringCharacter(s) used to draw the line.
style: StyleStyle for the rule line characters.
end: StringString appended after the rule (default "\n").
align: HorizontalAlignAlignment of the title within the rule.
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Rule with defaults: no title, “─” character,
rule.line style, newline end, center alignment.
Note: rich defaults to ─ (U+2500, light horizontal). The previous
default was ━ (U+2501, heavy); updated for rich parity.
Sourcepub fn with_title(title: &str) -> Self
pub fn with_title(title: &str) -> Self
Create a rule with a title string.
Sourcepub fn with_characters(self, chars: &str) -> Self
pub fn with_characters(self, chars: &str) -> Self
Set the line characters.
Sourcepub fn with_style(self, style: Style) -> Self
pub fn with_style(self, style: Style) -> Self
Set the rule style.
Sourcepub fn with_align(self, align: HorizontalAlign) -> Self
pub fn with_align(self, align: HorizontalAlign) -> Self
Set the alignment.
Trait Implementations§
Source§impl Renderable for Rule
impl Renderable for Rule
Source§fn gilt_console(
&self,
console: &Console,
options: &ConsoleOptions,
) -> Vec<Segment>
fn gilt_console( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Produce segments for rendering on the given console with given options.
Auto Trait Implementations§
impl !Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnsafeUnpin for Rule
impl UnwindSafe for Rule
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> RenderableExt for Twhere
T: Renderable + 'static,
impl<T> RenderableExt for Twhere
T: Renderable + 'static,
Source§fn into_boxed_renderable(self) -> RenderableBox
fn into_boxed_renderable(self) -> RenderableBox
Convert this renderable into a
RenderableBox for type-erased storage. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more