Patch

Struct Patch 

Source
pub struct Patch { /* private fields */ }
Expand description

Patch state.

Implementations§

Source§

impl Patch

Source

pub fn new( title: Title, target: MergeTarget, (id, revision): (RevisionId, Revision), ) -> Self

Construct a new patch object from a revision.

Source

pub fn title(&self) -> &str

Title of the patch.

Source

pub fn state(&self) -> &State

Current state of the patch.

Source

pub fn target(&self) -> MergeTarget

Target this patch is meant to be merged in.

Source

pub fn timestamp(&self) -> Timestamp

Timestamp of the first revision of the patch.

Source

pub fn labels(&self) -> impl Iterator<Item = &Label>

Associated labels.

Source

pub fn description(&self) -> &str

Patch description.

Source

pub fn embeds(&self) -> &[Embed<Uri>]

Patch embeds.

Source

pub fn author(&self) -> &Author

Author of the first revision of the patch.

Source

pub fn authors(&self) -> BTreeSet<&Author>

All revision authors.

Source

pub fn revision(&self, id: &RevisionId) -> Option<&Revision>

Get the Revision by its RevisionId.

None is returned if the Revision has been redacted (deleted).

Source

pub fn updates( &self, ) -> impl DoubleEndedIterator<Item = (RevisionId, &Revision)>

List of patch revisions by the patch author. The initial changeset is part of the first revision.

Source

pub fn revisions( &self, ) -> impl DoubleEndedIterator<Item = (RevisionId, &Revision)>

List of all patch revisions by all authors.

Source

pub fn revisions_by<'a>( &'a self, author: &'a PublicKey, ) -> impl DoubleEndedIterator<Item = (RevisionId, &'a Revision)>

List of patch revisions by the given author.

Source

pub fn reviews_of( &self, rev: RevisionId, ) -> impl Iterator<Item = (&ReviewId, &Review)>

List of patch reviews of the given revision.

Source

pub fn assignees(&self) -> impl Iterator<Item = Did> + '_

List of patch assignees.

Source

pub fn merges(&self) -> impl Iterator<Item = (&ActorId, &Merge)>

Get the merges.

Source

pub fn head(&self) -> &Oid

Reference to the Git object containing the code on the latest revision.

Source

pub fn base(&self) -> &Oid

Get the commit of the target branch on which this patch is based. This can change via a patch update.

Source

pub fn merge_base<R: ReadRepository>(&self, repo: &R) -> Result<Oid, Error>

Get the merge base of this patch.

Source

pub fn range(&self) -> Result<(Oid, Oid), Error>

Get the commit range of this patch.

Source

pub fn version(&self) -> RevisionIx

Index of latest revision in the revisions list.

Source

pub fn root(&self) -> (RevisionId, &Revision)

Root revision.

This is the revision that was created with the patch.

Source

pub fn latest(&self) -> (RevisionId, &Revision)

Latest revision by the patch author.

Source

pub fn latest_by<'a>( &'a self, author: &'a PublicKey, ) -> Option<(RevisionId, &'a Revision)>

Latest revision by the given author.

Source

pub fn updated_at(&self) -> Timestamp

Time of last update.

Source

pub fn is_merged(&self) -> bool

Check if the patch is merged.

Source

pub fn is_open(&self) -> bool

Check if the patch is open.

Source

pub fn is_archived(&self) -> bool

Check if the patch is archived.

Source

pub fn is_draft(&self) -> bool

Check if the patch is a draft.

Source

pub fn authorization( &self, action: &Action, actor: &ActorId, doc: &Doc, ) -> Result<Authorization, Error>

Apply authorization rules on patch actions.

Trait Implementations§

Source§

impl Clone for Patch

Source§

fn clone(&self) -> Patch

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Cob for Patch

Source§

type Action = Action

The underlying action composing each operation.
Source§

type Error = Error

Error returned by apply function.
Source§

fn from_root<R: ReadRepository>(op: Op, repo: &R) -> Result<Self, Self::Error>

Initialize a collaborative object from a root operation.
Source§

fn op<'a, R: ReadRepository, I: IntoIterator<Item = &'a Entry>>( &mut self, op: Op, concurrent: I, repo: &R, ) -> Result<(), Error>

Apply an operation to the state.
Source§

impl CobWithType for Patch

Source§

fn type_name() -> &'static TypeName

The type name of the collaborative object type which backs this implementation.
Source§

impl Debug for Patch

Source§

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

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

impl<'de> Deserialize<'de> for Patch

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<R: ReadRepository> Evaluate<R> for Patch

Source§

type Error = Error

Source§

fn init(entry: &Entry, repo: &R) -> Result<Self, Self::Error>

Initialize the object with the first (root) history entry.
Source§

fn apply<'a, I: Iterator<Item = (&'a EntryId, &'a Entry)>>( &mut self, entry: &Entry, concurrent: I, repo: &R, ) -> Result<(), Self::Error>

Apply a history entry to the evaluated state.
Source§

impl PartialEq for Patch

Source§

fn eq(&self, other: &Patch) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<R, C> Remove<Patch> for Cache<R, C>
where C: Remove<Patch>,

Source§

type Out = <C as Remove<Patch>>::Out

The output type, if any, for a successful removal.
Source§

type RemoveError = <C as Remove<Patch>>::RemoveError

Source§

fn remove(&mut self, id: &ObjectId) -> Result<Self::Out, Self::RemoveError>

Delete an object in the COB cache. Read more
Source§

fn remove_all(&mut self, rid: &RepoId) -> Result<Self::Out, Self::RemoveError>

Delete all entries from a repo.
Source§

impl Remove<Patch> for StoreWriter

Source§

type Out = bool

The output type, if any, for a successful removal.
Source§

type RemoveError = Error

Source§

fn remove(&mut self, id: &ObjectId) -> Result<Self::Out, Self::RemoveError>

Delete an object in the COB cache. Read more
Source§

fn remove_all(&mut self, rid: &RepoId) -> Result<Self::Out, Self::RemoveError>

Delete all entries from a repo.
Source§

impl Serialize for Patch

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<R, C> Update<Patch> for Cache<R, C>
where C: Update<Patch>,

Source§

type Out = <C as Update<Patch>>::Out

The output type, if any, for a successful update.
Source§

type UpdateError = <C as Update<Patch>>::UpdateError

Source§

fn update( &mut self, rid: &RepoId, id: &ObjectId, object: &Patch, ) -> Result<Self::Out, Self::UpdateError>

Source§

impl Update<Patch> for StoreWriter

Source§

type Out = bool

The output type, if any, for a successful update.
Source§

type UpdateError = UpdateError

Source§

fn update( &mut self, rid: &RepoId, id: &ObjectId, object: &Patch, ) -> Result<Self::Out, Self::UpdateError>

Source§

impl Eq for Patch

Source§

impl StructuralPartialEq for Patch

Auto Trait Implementations§

§

impl Freeze for Patch

§

impl RefUnwindSafe for Patch

§

impl Send for Patch

§

impl Sync for Patch

§

impl Unpin for Patch

§

impl UnwindSafe for Patch

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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 = 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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