pub struct RefCas<'a> {
pub name: String,
pub old: Option<&'a [u8]>,
pub new: Option<&'a [u8]>,
}Expand description
The typed ref rejection, re-exported so a consumer of this crate reaches it
without also naming the contract crate. RefRejection::of(&err) is the only
sanctioned way to ask whether a ref write lost a race — never a message.
One ref edit with the value the caller expects to find.
This is the field RefUpdate lacks, and its absence is the whole reason
git push --atomic could not be expressed: GitOps::put_refs is a batch
without compare-and-swap and GitOps::update_ref is compare-and-swap
without a batch, and --atomic is defined as both at once. Neither
composes into the other — applying a batch one CAS at a time is exactly the
partial application --atomic promises never to happen.
Borrowed, like every other oid in this contract: a receive-pack command line
is <old> <new> <ref> and both oids are already slices of the pkt-line the
caller is holding.
Fields§
§name: String§old: Option<&'a [u8]>What the caller believes is there. None means must not exist — a
create that must fail if anything is already at name.
There is deliberately no third “don’t care” state. receive-pack always
names an old value (all-zeroes for a create), so a caller that genuinely
does not care wants GitOps::put_refs, which is the batch that makes no
claim about the previous value.
new: Option<&'a [u8]>The new value. None deletes.
Trait Implementations§
impl<'a> Eq for RefCas<'a>
impl<'a> StructuralPartialEq for RefCas<'a>
Auto Trait Implementations§
impl<'a> Freeze for RefCas<'a>
impl<'a> RefUnwindSafe for RefCas<'a>
impl<'a> Send for RefCas<'a>
impl<'a> Sync for RefCas<'a>
impl<'a> Unpin for RefCas<'a>
impl<'a> UnsafeUnpin for RefCas<'a>
impl<'a> UnwindSafe for RefCas<'a>
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§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.