pub enum FieldChange {
Set {
from: String,
to: String,
},
Clear {
from: String,
},
NoChange {
value: String,
},
}Expand description
One field’s proposed change on one issue.
Variants§
Set
The field would take a new value.
Clear
The field would be emptied.
NoChange
The field already holds the requested value, so nothing is written for it.
A distinct variant, not a missing entry. The data-model’s rule is “a patch that is already the requested final state is a no-op and produces no duplicate History event”, and the way that is enforced is by knowing it — a plan that merely omitted the field could not distinguish “no-op” from “not considered”, and the History intent below depends on the difference.
Implementations§
Source§impl FieldChange
impl FieldChange
Sourcepub fn as_from_to(&self) -> (String, String)
pub fn as_from_to(&self) -> (String, String)
The change as (from, to), for a surface that projects a plan to a
structured value.
A method rather than a match in each surface, for the same reason
ItemOutcome::status is one: surface-parity.md §2 requires every surface
to expose the same “proposed before/after values”, and three matches over
these variants is three places for a fourth surface — or a new variant — to
disagree about what a Clear’s to is.
Clear’s to is the empty string, not null and not a missing key, so a
client reading to unconditionally gets a string for every field. A NoChange
reports from == to, which is the truth: the value would not move.
Trait Implementations§
Source§impl Clone for FieldChange
impl Clone for FieldChange
Source§impl Debug for FieldChange
impl Debug for FieldChange
impl Eq for FieldChange
Source§impl PartialEq for FieldChange
impl PartialEq for FieldChange
impl StructuralPartialEq for FieldChange
Auto Trait Implementations§
impl Freeze for FieldChange
impl RefUnwindSafe for FieldChange
impl Send for FieldChange
impl Sync for FieldChange
impl Unpin for FieldChange
impl UnsafeUnpin for FieldChange
impl UnwindSafe for FieldChange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more