Struct cosmic_text::Buffer

source ·
pub struct Buffer<'a> {
    pub lines: Vec<BufferLine>,
    /* private fields */
}
Expand description

A buffer of text that is shaped and laid out

Fields

lines: Vec<BufferLine>

BufferLines (or paragraphs) of text in the buffer

Implementations

Create a new Buffer with the provided FontSystem and Metrics

Pre-shape lines in the buffer, up to lines, return actual number of layout lines

Shape lines until cursor, also scrolling to include cursor in view

Shape lines until scroll

Get FontSystem used by this Buffer

Shape the provided line index and return the result

Lay out the provided line index and return the result

Get the current Metrics

Set the current Metrics

Get the current buffer dimensions (width, height)

Set the current buffer dimensions

Get the current scroll location

Set the current scroll location

Get the number of lines that can be viewed in the buffer

Set text of buffer, using provided attributes for each line by default

True if a redraw is needed

Set redraw needed flag

Get the visible layout runs for rendering and other tasks

Convert x, y position to Cursor (hit detection)

Draw the buffer

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.