Struct loro_delta::DeltaRope
source · pub struct DeltaRope<V: DeltaValue, Attr: DeltaAttr> { /* private fields */ }
Expand description
Implementations§
source§impl<V: DeltaValue, Attr: DeltaAttr> DeltaRope<V, Attr>
impl<V: DeltaValue, Attr: DeltaAttr> DeltaRope<V, Attr>
source§impl<V: DeltaValue, Attr: DeltaAttr> DeltaRope<V, Attr>
impl<V: DeltaValue, Attr: DeltaAttr> DeltaRope<V, Attr>
pub fn new() -> Self
pub fn first(&self) -> Option<&DeltaItem<V, Attr>>
pub fn iter(&self) -> impl Iterator<Item = &DeltaItem<V, Attr>>
pub fn is_empty(&self) -> bool
pub fn push_insert(&mut self, v: V, attr: Attr) -> &mut Self
pub fn push_retain(&mut self, retain: usize, attr: Attr) -> &mut Self
pub fn push_replace(&mut self, value: V, attr: Attr, delete: usize) -> &mut Self
pub fn push_delete(&mut self, len: usize) -> &mut Self
pub fn push(&mut self, item: DeltaItem<V, Attr>) -> &mut Self
sourcepub fn iter_with_len(&self) -> Iter<'_, V, Attr> ⓘ
pub fn iter_with_len(&self) -> Iter<'_, V, Attr> ⓘ
Returns an iterator that can iterate over the delta rope with a custom length.
It’s more controllable compared to the default iterator.
- Iterating over the delta rope with a custom length.
- You can peek the next item.
It’s useful to implement algorithms related to Delta
pub fn chop(&mut self)
source§impl<Attr: DeltaAttr> DeltaRope<TextChunk, Attr>
impl<Attr: DeltaAttr> DeltaRope<TextChunk, Attr>
pub fn insert_str(&mut self, index: usize, s: &str)
pub fn push_str_insert(&mut self, s: &str) -> &mut Self
pub fn push_str_insert_with_attr(&mut self, s: &str, attr: Attr) -> &mut Self
pub fn try_to_string(&self) -> Option<String>
Trait Implementations§
Auto Trait Implementations§
impl<V, Attr> Freeze for DeltaRope<V, Attr>
impl<V, Attr> RefUnwindSafe for DeltaRope<V, Attr>where
Attr: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, Attr> Send for DeltaRope<V, Attr>
impl<V, Attr> Sync for DeltaRope<V, Attr>
impl<V, Attr> Unpin for DeltaRope<V, Attr>
impl<V, Attr> UnwindSafe for DeltaRope<V, Attr>where
Attr: UnwindSafe,
V: UnwindSafe,
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more