pub struct MergeList { /* private fields */ }Expand description
A list of merge entries for a branch node’s children.
The merge list is used to track:
- Which children are present and in what order
- Which children have been moved within the list
- Which positions are “locked” (cannot be freely reordered)
- Hangon nodes at each position
Implementations§
Source§impl MergeList
impl MergeList
Sourcepub fn from_branch(parent: &NodeRef, edit_log: &mut EditLog) -> Self
pub fn from_branch(parent: &NodeRef, edit_log: &mut EditLog) -> Self
Creates a merge list from a branch node’s children.
Sourcepub fn add_entry(&mut self, entry: MergeEntry)
pub fn add_entry(&mut self, entry: MergeEntry)
Adds an entry to the list.
Sourcepub fn add_hangon(&mut self, node: NodeRef)
pub fn add_hangon(&mut self, node: NodeRef)
Adds a hangon to the current entry.
Sourcepub fn lock_neighborhood(&mut self, left: usize, right: usize)
pub fn lock_neighborhood(&mut self, left: usize, right: usize)
Locks entries around the current position.
Sourcepub fn lock_neighborhood_at(&mut self, pos: usize, left: usize, right: usize)
pub fn lock_neighborhood_at(&mut self, pos: usize, left: usize, right: usize)
Locks entries around the given position.
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
Returns the number of entries (including START and END).
Sourcepub fn entry(&self, ix: usize) -> Option<&MergeEntry>
pub fn entry(&self, ix: usize) -> Option<&MergeEntry>
Returns an entry by index.
Sourcepub fn entry_mut(&mut self, ix: usize) -> Option<&mut MergeEntry>
pub fn entry_mut(&mut self, ix: usize) -> Option<&mut MergeEntry>
Returns a mutable entry by index.
Sourcepub fn entries(&self) -> &[MergeEntry]
pub fn entries(&self) -> &[MergeEntry]
Returns all entries.
Sourcepub fn remove_entry_at(&mut self, ix: usize)
pub fn remove_entry_at(&mut self, ix: usize)
Removes the entry at the given index.
Sourcepub fn move_hangons_to_predecessor(&mut self, ix: usize)
pub fn move_hangons_to_predecessor(&mut self, ix: usize)
Moves hangons from entry at ix to its predecessor.
Sourcepub fn find_partner(&self, entry: &MergeEntry) -> Option<&MergeEntry>
pub fn find_partner(&self, entry: &MergeEntry) -> Option<&MergeEntry>
Finds the index of the partner entry (by base match).
Sourcepub fn find_partner_index(&self, entry: Option<&MergeEntry>) -> Option<usize>
pub fn find_partner_index(&self, entry: Option<&MergeEntry>) -> Option<usize>
Finds the index of the partner entry.
Sourcepub fn match_in_list(&self, base: &NodeRef) -> Option<usize>
pub fn match_in_list(&self, base: &NodeRef) -> Option<usize>
Finds the index of a base node in the list.
Sourcepub fn entry_parent(&self) -> Option<NodeRef>
pub fn entry_parent(&self) -> Option<NodeRef>
Returns the entry parent.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MergeList
impl !RefUnwindSafe for MergeList
impl !Send for MergeList
impl !Sync for MergeList
impl Unpin for MergeList
impl !UnwindSafe for MergeList
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