pub struct MeasurementConfig<'doc> { /* private fields */ }Expand description
Your entrypoint to navigating inside a ReadableDocument.
Implementations§
Source§impl<'doc> MeasurementConfig<'doc>
impl<'doc> MeasurementConfig<'doc>
Sourcepub fn new(buffer: &'doc dyn ReadableDocument) -> Self
pub fn new(buffer: &'doc dyn ReadableDocument) -> Self
Creates a new MeasurementConfig for the given document.
Sourcepub fn with_cursor(self, cursor: Cursor) -> Self
pub fn with_cursor(self, cursor: Cursor) -> Self
Sets the initial cursor to the given position.
WARNING: While the code doesn’t panic if the cursor is invalid, the results will obviously be complete garbage.
Sourcepub fn with_tab_size(self, tab_size: CoordType) -> Self
pub fn with_tab_size(self, tab_size: CoordType) -> Self
Sets the tab size.
Defaults to 8, because that’s what a tab in terminals evaluates to.
Sourcepub fn with_word_wrap_column(self, word_wrap_column: CoordType) -> Self
pub fn with_word_wrap_column(self, word_wrap_column: CoordType) -> Self
You want word wrap? Set it here!
Defaults to 0, which means no word wrap.
Sourcepub fn goto_offset(&mut self, offset: usize) -> Cursor
pub fn goto_offset(&mut self, offset: usize) -> Cursor
Sourcepub fn goto_logical(&mut self, logical_target: Point) -> Cursor
pub fn goto_logical(&mut self, logical_target: Point) -> Cursor
Navigates forward to the given logical position.
Logical positions are in lines and grapheme clusters.
§Returns
The cursor position after the navigation.
Sourcepub fn goto_visual(&mut self, visual_target: Point) -> Cursor
pub fn goto_visual(&mut self, visual_target: Point) -> Cursor
Navigates forward to the given visual position.
Visual positions are in laid out rows and columns.
§Returns
The cursor position after the navigation.
Trait Implementations§
Source§impl<'doc> Clone for MeasurementConfig<'doc>
impl<'doc> Clone for MeasurementConfig<'doc>
Source§fn clone(&self) -> MeasurementConfig<'doc>
fn clone(&self) -> MeasurementConfig<'doc>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'doc> Freeze for MeasurementConfig<'doc>
impl<'doc> !RefUnwindSafe for MeasurementConfig<'doc>
impl<'doc> !Send for MeasurementConfig<'doc>
impl<'doc> !Sync for MeasurementConfig<'doc>
impl<'doc> Unpin for MeasurementConfig<'doc>
impl<'doc> !UnwindSafe for MeasurementConfig<'doc>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more