Skip to main content

CellIteration

Struct CellIteration 

Source
pub struct CellIteration<'alloc, 's> { /* private fields */ }
Expand description

An active iteration over the cells on a given row within the render state.

Cell iterations are created by updating row iterators at a given row. The borrow checker statically guarantees that all accesses of the data do not outlive the given snapshot, at the cost of added lifetime annotations.

Implementations§

Source§

impl CellIteration<'_, '_>

Source

pub fn next(&mut self) -> Option<&Self>

Move a cell iteration to the next cell.

Returns Some(cell) if the iteration moved successfully and cell data is available to read at the new position using cell.

Source

pub fn select(&mut self, x: u16) -> Result<()>

Move a cell iteration to a specific column.

Positions the iteration at the given x (column) index so that subsequent reads return data for that cell.

Source

pub fn raw_cell(&self) -> Result<Cell>

The raw cell value.

Source

pub fn style(&self) -> Result<Style>

The style for the current cell.

Source

pub fn fg_color(&self) -> Result<Option<RgbColor>>

The resolved foreground color of the cell.

Resolves palette indices through the palette. Bold color handling is not applied; the caller should handle bold styling separately.

Returns None if the cell has no explicit foreground color, in which case the caller should use whatever default foreground color it want (e.g. the terminal foreground).

Source

pub fn bg_color(&self) -> Result<Option<RgbColor>>

The resolved background color of the cell.

Flattens the three possible sources: Cell::bg_color_rgb, Cell::bg_color_palette (looked up in the palette), or the style’s bg_color.

Returns None if the cell has no background color, in which case the caller should use whatever default background color it wants (e.g. the terminal background).

Source

pub fn graphemes(&self) -> Result<Vec<char>>

Get the grapheme codepoints.

The base codepoint is placed first, followed by any extra codepoints.

Source

pub fn graphemes_len(&self) -> Result<usize>

The total number of grapheme codepoints including the base codepoint.

Returns 0 if the cell has no text.

Source

pub fn graphemes_buf(&self, buf: &mut [char]) -> Result<()>

Write grapheme codepoints into a caller-provided buffer.

The buffer must be at least CellIteration::graphemes_len elements. The base codepoint is written first, followed by any extra codepoints.

Trait Implementations§

Source§

impl<'alloc, 's> Debug for CellIteration<'alloc, 's>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'alloc, 's> Freeze for CellIteration<'alloc, 's>

§

impl<'alloc, 's> RefUnwindSafe for CellIteration<'alloc, 's>

§

impl<'alloc, 's> !Send for CellIteration<'alloc, 's>

§

impl<'alloc, 's> !Sync for CellIteration<'alloc, 's>

§

impl<'alloc, 's> Unpin for CellIteration<'alloc, 's>

§

impl<'alloc, 's> UnsafeUnpin for CellIteration<'alloc, 's>

§

impl<'alloc, 's> !UnwindSafe for CellIteration<'alloc, 's>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.