Enum git_ref::transaction::Change
source · pub enum Change {
Update {
log: LogChange,
expected: PreviousValue,
new: Target,
},
Delete {
expected: PreviousValue,
log: RefLog,
},
}
Expand description
A description of an edit to perform.
Variants
Update
Fields
log: LogChange
The desired change to the reference log.
expected: PreviousValue
The expected value already present in the reference.
If a ref was existing previously it will be overwritten at MustExistAndMatch(actual_value)
for use after
the transaction was committed successfully.
new: Target
The new state of the reference, either for updating an existing one or creating a new one.
If previous is not None
, the ref must exist and its oid
must agree with the previous
, and
we function like update
.
Otherwise it functions as create-or-update
.
Delete
Fields
expected: PreviousValue
The expected value of the reference, with the MustNotExist
variant being invalid.
If a previous ref existed, this value will be filled in automatically as MustExistAndMatch(actual_value)
and
can be accessed if the transaction was committed successfully.
log: RefLog
How to treat the reference log during deletion.
Delete a reference and optionally check if previous
is its content.
Implementations
sourceimpl Change
impl Change
sourcepub fn new_value(&self) -> Option<TargetRef<'_>>
pub fn new_value(&self) -> Option<TargetRef<'_>>
Return references to values that are the new value after the change is applied, if this is an update.
sourcepub fn previous_value(&self) -> Option<TargetRef<'_>>
pub fn previous_value(&self) -> Option<TargetRef<'_>>
Return references to values that are in common between all variants and denote the previous observed value.
Trait Implementations
sourceimpl Ord for Change
impl Ord for Change
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialOrd<Change> for Change
impl PartialOrd<Change> for Change
sourcefn partial_cmp(&self, other: &Change) -> Option<Ordering>
fn partial_cmp(&self, other: &Change) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more