Struct Patches

Source
pub struct Patches<'a, R> { /* private fields */ }

Implementations§

Source§

impl<'a, R> Patches<'a, R>
where R: ReadRepository + Store<Namespace = NodeId>,

Source

pub fn open(repository: &'a R) -> Result<Self, RepositoryError>

Open a patches store.

Source

pub fn counts(&self) -> Result<PatchCounts, Error>

Patches count by state.

Source

pub fn find_by_revision( &self, revision: &RevisionId, ) -> Result<Option<ByRevision>, Error>

Find the Patch containing the given Revision.

Source

pub fn get(&self, id: &ObjectId) -> Result<Option<Patch>, Error>

Get a patch.

Source

pub fn proposed( &self, ) -> Result<impl Iterator<Item = (PatchId, Patch)> + '_, Error>

Get proposed patches.

Source

pub fn proposed_by<'b>( &'b self, who: &'b Did, ) -> Result<impl Iterator<Item = (PatchId, Patch)> + 'b, Error>

Get patches proposed by the given key.

Source§

impl<'a, R> Patches<'a, R>
where R: ReadRepository + SignRepository + Store<Namespace = NodeId>,

Source

pub fn create<'g, C, G>( &'g mut self, title: impl ToString, description: impl ToString, target: MergeTarget, base: impl Into<Oid>, oid: impl Into<Oid>, labels: &[Label], cache: &'g mut C, signer: &Device<G>, ) -> Result<PatchMut<'a, 'g, R, C>, Error>
where C: Update<Patch>, G: Signer<Signature>,

Open a new patch.

Source

pub fn draft<'g, C, G>( &'g mut self, title: impl ToString, description: impl ToString, target: MergeTarget, base: impl Into<Oid>, oid: impl Into<Oid>, labels: &[Label], cache: &'g mut C, signer: &Device<G>, ) -> Result<PatchMut<'a, 'g, R, C>, Error>
where C: Update<Patch>, G: Signer<Signature>,

Draft a patch. This patch will be created in a State::Draft state.

Source

pub fn get_mut<'g, C>( &'g mut self, id: &ObjectId, cache: &'g mut C, ) -> Result<PatchMut<'a, 'g, R, C>, Error>

Get a patch mutably.

Methods from Deref<Target = Store<'a, Patch, R>>§

Source

pub fn transaction( &self, actions: Vec<T::Action>, embeds: Vec<Embed<Uri>>, ) -> Transaction<T, R>

Source

pub fn update<G>( &self, type_name: &TypeName, object_id: ObjectId, message: &str, actions: impl Into<NonEmpty<T::Action>>, embeds: Vec<Embed<Uri>>, signer: &Device<G>, ) -> Result<Updated<T>, Error>
where G: Signer<Signature>,

Update an object.

Source

pub fn create<G>( &self, message: &str, actions: impl Into<NonEmpty<T::Action>>, embeds: Vec<Embed<Uri>>, signer: &Device<G>, ) -> Result<(ObjectId, T), Error>
where G: Signer<Signature>,

Create an object.

Source

pub fn remove<G>(&self, id: &ObjectId, signer: &Device<G>) -> Result<(), Error>
where G: Signer<Signature>,

Remove an object.

Source

pub fn get(&self, id: &ObjectId) -> Result<Option<T>, Error>

Get an object.

Source

pub fn all( &self, ) -> Result<impl ExactSizeIterator<Item = Result<(ObjectId, T), Error>> + 'a, Error>

Return all objects.

Source

pub fn is_empty(&self) -> Result<bool, Error>

Return true if the list of issues is empty.

Source

pub fn count(&self) -> Result<usize, Error>

Return objects count.

Trait Implementations§

Source§

impl<'a, R> Deref for Patches<'a, R>

Source§

type Target = Store<'a, Patch, R>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<R> HasRepoId for Patches<'_, R>
where R: ReadRepository,

Source§

fn rid(&self) -> RepoId

Auto Trait Implementations§

§

impl<'a, R> Freeze for Patches<'a, R>

§

impl<'a, R> RefUnwindSafe for Patches<'a, R>
where R: RefUnwindSafe,

§

impl<'a, R> Send for Patches<'a, R>
where R: Sync,

§

impl<'a, R> Sync for Patches<'a, R>
where R: Sync,

§

impl<'a, R> Unpin for Patches<'a, R>

§

impl<'a, R> UnwindSafe for Patches<'a, R>
where R: RefUnwindSafe,

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,