Struct radicle_cob::history::History
source · pub struct History { /* private fields */ }
Expand description
The DAG of changes making up the history of a collaborative object.
Implementations§
source§impl History
impl History
sourcepub fn new(root: EntryId, graph: Dag<EntryId, Entry>) -> Self
pub fn new(root: EntryId, graph: Dag<EntryId, Entry>) -> Self
Create a new history from a DAG. Panics if the root is not part of the graph.
sourcepub fn new_from_root(root: Entry) -> Self
pub fn new_from_root(root: Entry) -> Self
Create a new history from a root entry.
sourcepub fn traverse<F, A>(&self, init: A, roots: &[EntryId], f: F) -> A
pub fn traverse<F, A>(&self, init: A, roots: &[EntryId], f: F) -> A
A topological (parents before children) traversal of the dependency
graph of this history. This is analagous to
std::iter::Iterator::fold
in that it folds every change into an
accumulator value of type A
. However, unlike fold
the function f
may prune branches from the dependency graph by returning
ControlFlow::Break
.
sourcepub fn sorted<F>(&self, compare: F) -> impl Iterator<Item = &Entry>
pub fn sorted<F>(&self, compare: F) -> impl Iterator<Item = &Entry>
Return a topologically-sorted list of history entries.
sourcepub fn children_of(&self, id: &EntryId) -> Vec<EntryId>
pub fn children_of(&self, id: &EntryId) -> Vec<EntryId>
Get the children of the given entry.
Trait Implementations§
impl Eq for History
Auto Trait Implementations§
impl Freeze for History
impl RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl UnwindSafe for History
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)