Skip to main content

LinksUndoLog

Struct LinksUndoLog 

Source
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

Source

pub fn new() -> Self

Source

pub fn is_empty(&self) -> bool

Whether nothing is kept.

Source

pub fn changes(&self) -> &[LinkChange] ⓘ

The changes kept, in the order they were made.

Source

pub fn record(&mut self, before: Option<Link>, after: Option<Link>)

Keeps one change; a change that changes nothing is not kept.

Source

pub fn record_observed(&mut self, before: Link, after: Link)

Keeps one change as a ChangeObserver reports it: the null link is no link.

Source

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.

Source

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.

Source

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.

Source

pub fn clear(&mut self)

Forgets everything kept: the writes stay.

Source

pub fn undo<L: NamedTypeLinks + ?Sized>( &mut self, links: &mut L, ) -> Result<Vec<u32>>

Undoes every write kept, on links (the store the writes were made on, not a view over it), and forgets them.

Returns the addresses of the links the writes created, now deleted again.

Trait Implementations§

Source§

impl Clone for LinksUndoLog

Source§

fn clone(&self) -> Self

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 LinksUndoLog

Source§

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

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

impl Default for LinksUndoLog

Source§

fn default() -> Self

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

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.