Struct radicle_surf::vcs::History[][src]

pub struct History<A>(pub NonEmpty<A>);

A non-empty bag of artifacts which are used to derive a crate::file_system::Directory view. Examples of artifacts would be commits in Git or patches in Pijul.

Implementations

impl<A> History<A>[src]

pub fn new(a: A) -> Self[src]

Create a new History consisting of one artifact.

pub fn push(&mut self, a: A)[src]

Push an artifact to the end of the History.

pub fn iter<'a>(&'a self) -> impl Iterator<Item = &A> + 'a[src]

Iterator over the artifacts.

pub fn first(&self) -> &A[src]

Get the firest artifact in the History.

pub fn len(&self) -> usize[src]

Get the length of History (aka the artefacts count)

pub fn is_empty(&self) -> bool[src]

Check if History is empty

pub fn find_suffix(&self, artifact: &A) -> Option<Self> where
    A: Clone + PartialEq
[src]

Given that the History is topological order from most recent artifact to least recent, find_suffix gets returns the history up until the point of the given artifact.

This operation may fail if the artifact does not exist in the given History.

pub fn map<F, B>(self, f: F) -> History<B> where
    F: FnMut(A) -> B, 
[src]

Apply a function from A to B over the History

pub fn find<F, B>(&self, f: F) -> Option<B> where
    F: Fn(&A) -> Option<B>, 
[src]

Find an artifact in the History.

The function provided should return Some if the item is the desired output and None otherwise.

pub fn find_in_history<Identifier, F>(
    &self,
    identifier: &Identifier,
    id_of: F
) -> Option<A> where
    A: Clone,
    F: Fn(&A) -> Identifier,
    Identifier: PartialEq
[src]

Find an atrifact in the given History using the artifacts ID.

This operation may fail if the artifact does not exist in the history.

pub fn find_in_histories<Identifier, F>(
    histories: Vec<Self>,
    identifier: &Identifier,
    id_of: F
) -> Vec<Self> where
    A: Clone,
    F: Fn(&A) -> Identifier + Copy,
    Identifier: PartialEq
[src]

Find all occurences of an artifact in a bag of Historys.

Trait Implementations

impl<A: Clone> Clone for History<A>[src]

impl<A: Debug> Debug for History<A>[src]

impl<A: Eq> Eq for History<A>[src]

impl<A: Ord> Ord for History<A>[src]

impl<A: PartialEq> PartialEq<History<A>> for History<A>[src]

impl<A: PartialOrd> PartialOrd<History<A>> for History<A>[src]

impl<A> StructuralEq for History<A>[src]

impl<A> StructuralPartialEq for History<A>[src]

Auto Trait Implementations

impl<A> RefUnwindSafe for History<A> where
    A: RefUnwindSafe

impl<A> Send for History<A> where
    A: Send

impl<A> Sync for History<A> where
    A: Sync

impl<A> Unpin for History<A> where
    A: Unpin

impl<A> UnwindSafe for History<A> where
    A: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.