Skip to main content

ChangeBundle

Struct ChangeBundle 

Source
pub struct ChangeBundle {
    pub delta: Delta,
    pub island_ops: Vec<IslandOp>,
    pub line_ops: Vec<LineOp>,
    pub mark_ops: Vec<MarkOp>,
}
Expand description

One committed field edit: a text delta and the three op channels, applied in field order (delta → islands → lines → marks) by Content::apply_field_change.

A struct rather than four positional arguments so a fifth channel is an additive change at every call site. Default is the identity bundle (no text change, no ops), so a caller names only the channels it uses: ChangeBundle { delta, ..Default::default() }.

Within a channel ops apply in sequence: op n’s coordinates read the state ops 0..n left, not the frame the channel opens in. That is USV positions for an island insert (its at counts the slots earlier inserts spliced) and line indices for LineOp::Split / LineOp::Join, which renumber every later line. A stale frame stays in range, so the bundle applies cleanly and lands the wrong document.

Fields§

§delta: Delta

The text splice; the identity delta (no ops) is no text change.

§island_ops: Vec<IslandOp>

Island edits, opening in post-delta coordinates and sequenced.

§line_ops: Vec<LineOp>

Line edits, opening in post-delta, post-island-op coordinates and sequenced.

§mark_ops: Vec<MarkOp>

Mark edits, in final-text coordinates (every earlier stage applied).

Implementations§

Source§

impl ChangeBundle

Source

pub fn from_delta(delta: Delta) -> ChangeBundle

A bundle carrying delta and no ops: the per-keystroke splice.

Trait Implementations§

Source§

impl Clone for ChangeBundle

Source§

fn clone(&self) -> ChangeBundle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ChangeBundle

Source§

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

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

impl Default for ChangeBundle

Source§

fn default() -> ChangeBundle

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ChangeBundle

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ChangeBundle

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.