Patches

Trait Patches 

Source
pub trait Patches {
    type Error: Error + Send + Sync + 'static;
    type Iter<'a>: Iterator<Item = Result<(PatchId, Patch), Self::Error>> + 'a
       where Self: 'a;

    // Required methods
    fn get(&self, id: &PatchId) -> Result<Option<Patch>, Self::Error>;
    fn find_by_revision(
        &self,
        id: &RevisionId,
    ) -> Result<Option<ByRevision>, Self::Error>;
    fn list(&self) -> Result<Self::Iter<'_>, Self::Error>;
    fn list_by_status(
        &self,
        status: &Status,
    ) -> Result<Self::Iter<'_>, Self::Error>;
    fn counts(&self) -> Result<PatchCounts, Self::Error>;

    // Provided methods
    fn opened(&self) -> Result<Self::Iter<'_>, Self::Error> { ... }
    fn archived(&self) -> Result<Self::Iter<'_>, Self::Error> { ... }
    fn drafted(&self) -> Result<Self::Iter<'_>, Self::Error> { ... }
    fn merged(&self) -> Result<Self::Iter<'_>, Self::Error> { ... }
    fn is_empty(&self) -> Result<bool, Self::Error> { ... }
}
Expand description

A set of read-only methods for a Patch store.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Source

type Iter<'a>: Iterator<Item = Result<(PatchId, Patch), Self::Error>> + 'a where Self: 'a

An iterator for returning a set of patches from the store.

Required Methods§

Source

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

Get the Patch, identified by id, returning None if it was not found.

Source

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

Get the Patch and its Revision, identified by the revision id, returning None if it was not found.

Source

fn list(&self) -> Result<Self::Iter<'_>, Self::Error>

List all patches that are in the store.

Source

fn list_by_status(&self, status: &Status) -> Result<Self::Iter<'_>, Self::Error>

List all patches in the store that match the provided status.

Also see Patches::opened, Patches::archived, Patches::drafted, Patches::merged.

Source

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

Get the PatchCounts of all the patches in the store.

Provided Methods§

Source

fn opened(&self) -> Result<Self::Iter<'_>, Self::Error>

List all opened patches in the store.

Source

fn archived(&self) -> Result<Self::Iter<'_>, Self::Error>

List all archived patches in the store.

Source

fn drafted(&self) -> Result<Self::Iter<'_>, Self::Error>

List all drafted patches in the store.

Source

fn merged(&self) -> Result<Self::Iter<'_>, Self::Error>

List all merged patches in the store.

Source

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

Returns true if there are no patches in the store.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R> Patches for Cache<Patches<'_, R>, NoCache>
where R: ReadRepository + Store<Namespace = NodeId>,

Source§

type Error = Error

Source§

type Iter<'b> = NoCacheIter<'b> where Self: 'b

Source§

impl<R> Patches for Cache<R, StoreReader>
where R: HasRepoId,

Source§

type Error = Error

Source§

type Iter<'b> = PatchesIter<'b> where Self: 'b

Source§

impl<R> Patches for Cache<R, StoreWriter>
where R: HasRepoId,

Source§

type Error = Error

Source§

type Iter<'b> = PatchesIter<'b> where Self: 'b