Skip to main content

SnapshotGenerator

Struct SnapshotGenerator 

Source
pub struct SnapshotGenerator { /* private fields */ }
Expand description

Headless snapshot generator

Integrates all components to generate snapshots needed for UI rendering

Implementations§

Source§

impl SnapshotGenerator

Source

pub fn new(viewport_width: usize) -> Self

Create a new generator for an empty document.

Source

pub fn from_text(text: &str, viewport_width: usize) -> Self

Initialize from text

Source

pub fn from_text_with_tab_width( text: &str, viewport_width: usize, tab_width: usize, ) -> Self

Initialize from text, with explicit tab_width (in cells) for expanding '\t'.

Source

pub fn set_lines(&mut self, lines: Vec<String>)

Update document content

Source

pub fn set_viewport_width(&mut self, width: usize)

Set viewport width

Source

pub fn set_tab_width(&mut self, tab_width: usize)

Set tab width (in cells) used for expanding '\t'.

Source

pub fn tab_width(&self) -> usize

Get tab width (in cells).

Source

pub fn get_headless_grid( &self, start_visual_row: usize, count: usize, ) -> HeadlessGrid

Get headless grid snapshot

This is the core API, returning visual line data for the specified range

Source

pub fn get_line(&self, line_index: usize) -> Option<&str>

Get content of a specific logical line

Source

pub fn line_count(&self) -> usize

Get total number of logical lines

Auto Trait Implementations§

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.