Struct ad_editor::buffer::Buffer

source ·
pub struct Buffer { /* private fields */ }

Implementations§

source§

impl Buffer

source

pub fn new_unnamed(id: usize, content: &str) -> Self

source

pub fn new_virtual(id: usize, name: String, content: String) -> Self

source

pub fn display_name(&self, cwd: &Path) -> String

Short name for displaying in the status line

source

pub fn full_name(&self) -> &str

Absolute path of full name of a virtual buffer

source

pub fn dir(&self) -> Option<&Path>

source

pub fn is_unnamed(&self) -> bool

source

pub fn contents(&self) -> Vec<u8>

source

pub fn str_contents(&self) -> String

source

pub fn dot_contents(&self) -> String

source

pub fn addr(&self) -> String

source

pub fn xdot_contents(&self) -> String

source

pub fn xaddr(&self) -> String

source

pub fn len_lines(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn clamp_scroll(&mut self, screen_rows: usize, screen_cols: usize)

source

pub fn view_port( &mut self, vp: ViewPort, screen_rows: usize, screen_cols: usize, )

source

pub fn line(&self, y: usize) -> Option<Slice<'_>>

Trait Implementations§

source§

impl Address for Buffer

source§

fn current_dot(&self) -> Dot

This only really makes sense for use with a buffer but is supported so that don’t need to special case running programs against an in-editor buffer vs stdin or a file read from disk.
source§

fn len_chars(&self) -> usize

source§

fn line_to_char(&self, line_idx: usize) -> Option<usize>

source§

fn char_to_line(&self, char_idx: usize) -> Option<usize>

source§

fn char_to_line_end(&self, char_idx: usize) -> Option<usize>

source§

fn char_to_line_start(&self, char_idx: usize) -> Option<usize>

source§

fn max_iter(&self) -> usize

source§

fn map_addr(&self, a: &mut Addr) -> Dot

source§

fn full_line(&self, line_idx: usize) -> Option<Dot>

source§

fn map_simple_addr(&self, addr: &mut SimpleAddr, cur_dot: Dot) -> Option<Dot>

source§

fn map_compound_addr( &self, from: &mut SimpleAddr, to: &mut SimpleAddr, ) -> Option<Dot>

source§

impl Clone for Buffer

source§

fn clone(&self) -> Buffer

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Buffer

source§

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

Formats the value using the given formatter. Read more
source§

impl Edit for Buffer

source§

fn contents(&self) -> String

source§

fn insert(&mut self, idx: usize, s: &str)

source§

fn remove(&mut self, from: usize, to: usize)

source§

fn begin_edit_transaction(&mut self)

source§

fn end_edit_transaction(&mut self)

source§

impl IterBoundedChars for Buffer

source§

fn iter_between(&self, from: usize, to: usize) -> CharIter<'_>

Iterate forward: from -> to Read more
source§

fn rev_iter_between(&self, from: usize, to: usize) -> CharIter<'_>

Iterate backward: from -> to Read more
source§

impl PartialEq for Buffer

source§

fn eq(&self, other: &Buffer) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Buffer

source§

impl StructuralPartialEq for Buffer

Auto Trait Implementations§

§

impl !Freeze for Buffer

§

impl !RefUnwindSafe for Buffer

§

impl !Send for Buffer

§

impl !Sync for Buffer

§

impl Unpin for Buffer

§

impl UnwindSafe for Buffer

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.