pub struct StyledText {
    pub buffer: Vec<(Style, String)>,
}
Expand description

A representation of a buffer with styling, used for doing syntax highlighting

Fields

buffer: Vec<(Style, String)>

The component, styled parts of the text

Implementations

Construct a new StyledText

Add a new styled string to the buffer

Render the styled string. We use the insertion point to render around so that we can properly write out the styled string to the screen and find the correct place to put the cursor. This assumes a logic that prints the first part of the string, saves the cursor position, prints the second half, and then restores the cursor position

Also inserts the multiline continuation prompt

Apply the ANSI style formatting to the full string.

Get the unformatted text as a single continuous string.

Trait Implementations

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.