Struct bvr_core::buf::SegBuffer

source ·
pub struct SegBuffer { /* private fields */ }
Expand description

A segmented buffer that holds data in multiple segments.

The Buffer struct represents a buffer that is divided into multiple segments. It contains the LineIndex and the internal representation of the segments.

Implementations§

source§

impl SegBuffer

source

pub fn read_file( file: File, seg_count: NonZeroUsize, complete: bool ) -> Result<Self>

source

pub fn read_stream(stream: BoxedStream, complete: bool) -> Result<Self>

source

pub fn line_count(&self) -> usize

Return the line count of this SegBuffer.

source

pub fn index(&self) -> &LineIndex

Return the LineIndex of this SegBuffer.

source

pub fn get_bytes(&self, line_number: usize) -> Option<SegBytes>

source

pub fn get_line(&self, line_number: usize) -> Option<SegStr>

Retrieves a line of text from the buffer based on the given line number.

Panics

This function will panic if the line_number is greater than the total number of lines in the buffer’s index.

Returns

The line of text as a SegStr object.

source

pub fn segment_iter(&self) -> Result<ContiguousSegmentIterator>

source

pub fn all_line_matches(&self) -> LineSet

source

pub fn write_file(&mut self, output: File, lines: LineSet) -> Result<()>

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>,

§

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>,

§

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.