pub struct LinksUndoLog { /* private fields */ }Expand description
The writes made to a store, kept to undo them: every change a write reports, and the names the links had before.
Undoing goes back through the changes: it deletes what was created,
updates back what was updated and creates again, at the same address,
what was deleted. Names are not changes: a deleted link loses its name
before anyone above the names store hears of the deletion, so the names a
write may touch are kept before it, with keep_name
and keep_names_of_usages.
Implementations§
Source§impl LinksUndoLog
impl LinksUndoLog
pub fn new() -> Self
Sourcepub fn changes(&self) -> &[LinkChange] ⓘ
pub fn changes(&self) -> &[LinkChange] ⓘ
The changes kept, in the order they were made.
Sourcepub fn record(&mut self, before: Option<Link>, after: Option<Link>)
pub fn record(&mut self, before: Option<Link>, after: Option<Link>)
Keeps one change; a change that changes nothing is not kept.
Sourcepub fn record_observed(&mut self, before: Link, after: Link)
pub fn record_observed(&mut self, before: Link, after: Link)
Keeps one change as a ChangeObserver reports it: the null link is
no link.
Sourcepub fn keep_name<L: NamedTypeLinks + ?Sized>(
&mut self,
names: &mut L,
link: u32,
) -> Result<()>
pub fn keep_name<L: NamedTypeLinks + ?Sized>( &mut self, names: &mut L, link: u32, ) -> Result<()>
Keeps the name link has now, unless one of it is kept already.
Sourcepub fn keep_holder_of<L: NamedTypeLinks + ?Sized>(
&mut self,
links: &mut L,
name: &str,
) -> Result<()>
pub fn keep_holder_of<L: NamedTypeLinks + ?Sized>( &mut self, links: &mut L, name: &str, ) -> Result<()>
Keeps the name of the link called name now, if any.
Sourcepub fn keep_names_of_usages<L: NamedTypeLinks + ?Sized>(
&mut self,
links: &mut L,
link: u32,
) -> Result<()>
pub fn keep_names_of_usages<L: NamedTypeLinks + ?Sized>( &mut self, links: &mut L, link: u32, ) -> Result<()>
Keeps the names of link and of every link that uses it, directly or
not: the links deleting it deletes, or merging it repoints.