Skip to main content

RichSink

Trait RichSink 

Source
pub trait RichSink {
    // Required methods
    fn run(&mut self, style: Style, text: &str);
    fn newline(&mut self);

    // Provided method
    fn soft_wrap(&mut self) { ... }
}
Expand description

Receives styled runs and row breaks. run text contains neither newlines nor escapes; external ANSI text must cross decompose exactly once.

Required Methods§

Source

fn run(&mut self, style: Style, text: &str)

Appends a styled text run to the current row.

Source

fn newline(&mut self)

Completes the current row and starts another logical row.

Provided Methods§

Source

fn soft_wrap(&mut self)

Completes the current row at a mid-word soft wrap: the text continues on the next row purely because it hit the layout width, with no whitespace collapsed at the break.

Provenance-tracking sinks keep the boundary joinable so the renderer can re-join it with terminal autowrap; the default treats it as a RichSink::newline.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RichSink for String

ANSI-materializing boundary sink.

Each run carries a complete style prefix, so a String has no hidden style state. Text passed to this sink is escape-free by the RichSink contract.

Source§

fn run(&mut self, style: Style, text: &str)

Source§

fn newline(&mut self)

Source§

impl<S: RichSink + ?Sized> RichSink for &mut S

Source§

fn run(&mut self, style: Style, text: &str)

Source§

fn newline(&mut self)

Source§

fn soft_wrap(&mut self)

Implementors§