pub struct RopeBuffer { /* private fields */ }Expand description
A mutable buffer for rope-based source code, supporting efficient edits.
Implementations§
Source§impl RopeBuffer
impl RopeBuffer
Sourcepub fn new_with_url(input: impl ToString, url: impl Into<Option<Url>>) -> Self
pub fn new_with_url(input: impl ToString, url: impl Into<Option<Url>>) -> Self
Creates a new RopeBuffer with the specified input and URL.
Sourcepub fn snapshot(&self) -> RopeSource
pub fn snapshot(&self) -> RopeSource
Returns a read-only snapshot of the current buffer.
Sourcepub fn apply_edits_range(&mut self, edits: &[TextEdit]) -> Range<usize>
pub fn apply_edits_range(&mut self, edits: &[TextEdit]) -> Range<usize>
Applies multiple text edits to the buffer and returns the affected range.
Sourcepub fn apply_edits(&mut self, edits: &[TextEdit]) -> usize
pub fn apply_edits(&mut self, edits: &[TextEdit]) -> usize
Applies multiple text edits to the buffer and returns the minimum affected offset.
Trait Implementations§
Source§impl Clone for RopeBuffer
impl Clone for RopeBuffer
Source§fn clone(&self) -> RopeBuffer
fn clone(&self) -> RopeBuffer
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 moreSource§impl Debug for RopeBuffer
impl Debug for RopeBuffer
Source§impl Source for RopeBuffer
impl Source for RopeBuffer
Source§fn chunk_at(&self, offset: usize) -> TextChunk<'_>
fn chunk_at(&self, offset: usize) -> TextChunk<'_>
Returns a text chunk containing the specified offset.
Source§fn get_text_in(&self, range: Range<usize>) -> Cow<'_, str>
fn get_text_in(&self, range: Range<usize>) -> Cow<'_, str>
Get the text content at the specified range. Read more
Source§fn get_char_at(&self, offset: usize) -> Option<char>
fn get_char_at(&self, offset: usize) -> Option<char>
Get a single character at the specified offset. Read more
Source§fn get_text_from(&self, offset: usize) -> Cow<'_, str>
fn get_text_from(&self, offset: usize) -> Cow<'_, str>
Get the text from the current position to the end of the source. Read more
Source§fn find_char_from(&self, offset: usize, ch: char) -> Option<usize>
fn find_char_from(&self, offset: usize, ch: char) -> Option<usize>
Find the next occurrence of a character starting from an offset. Read more
Auto Trait Implementations§
impl Freeze for RopeBuffer
impl RefUnwindSafe for RopeBuffer
impl Send for RopeBuffer
impl Sync for RopeBuffer
impl Unpin for RopeBuffer
impl UnwindSafe for RopeBuffer
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