Struct ContractLock
pub struct ContractLock {
pub format: u32,
pub domain: String,
pub contracts: BTreeMap<String, Value>,
pub generations: Vec<Generation>,
}Expand description
A parsed, integrity-checked lock file.
Fields§
§format: u32§domain: StringThe op-contract domain tag the digests were taken under.
contracts: BTreeMap<String, Value>Op digest (hex) to that op’s canonical contract.
generations: Vec<Generation>Oldest first.
Implementations§
§impl ContractLock
impl ContractLock
pub fn new() -> ContractLock
pub fn new() -> ContractLock
A lock with no generations.
pub fn parse(text: &str) -> Result<ContractLock, LockError>
pub fn parse(text: &str) -> Result<ContractLock, LockError>
Parse and integrity-check a lock file: format and domain, every
stored contract hashing to its key, every generation’s digests
present. It does not judge compatibility (see
ContractLock::accepted).
§impl ContractLock
impl ContractLock
pub fn is_locked(&self, schema: &Schema) -> bool
pub fn is_locked(&self, schema: &Schema) -> bool
Whether the schema’s current contract is a recorded generation.
pub fn lock_generation(
&mut self,
schema: &Schema,
locked_at: &str,
note: &str,
) -> Result<bool, LockError>
pub fn lock_generation( &mut self, schema: &Schema, locked_at: &str, note: &str, ) -> Result<bool, LockError>
Record the schema’s current contracts as a new generation. Returns
false, changing nothing, when that client contract is already a
generation (locking is idempotent). locked_at must be a real
YYYY-MM-DD date, or LockError::Date and nothing changes.
pub fn incompatible(&self, schema: &Schema) -> Vec<Incompatible>
pub fn incompatible(&self, schema: &Schema) -> Vec<Incompatible>
Every locked contract of a still-existing op whose digest is not the current one and which the current contract is not compatible with.
pub fn accepted(
&self,
schema: &Schema,
) -> Result<Vec<(String, Vec<[u8; 32]>)>, LockError>
pub fn accepted( &self, schema: &Schema, ) -> Result<Vec<(String, Vec<[u8; 32]>)>, LockError>
The server’s accepted table: per op key (and batch), the current
digest, then every locked digest of that op newest first. Fails with
LockError::Incompatible when any locked contract of an existing
op is not compatible with the current one, so an incompatible entry
is never accepted silently.
§impl ContractLock
impl ContractLock
pub fn prune_op(&mut self, key: &str) -> Pruned
pub fn prune_op(&mut self, key: &str) -> Pruned
Stop accepting older clients of one op: remove its entry from every generation. This is how a breaking change to an op is shipped on purpose.
pub fn prune_before(&mut self, date: &str) -> Result<Pruned, LockError>
pub fn prune_before(&mut self, date: &str) -> Result<Pruned, LockError>
Remove the generations locked before date (a real YYYY-MM-DD
date, compared as a date; LockError::Date and nothing removed
otherwise).
pub fn prune_keep(&mut self, keep: usize) -> Pruned
pub fn prune_keep(&mut self, keep: usize) -> Pruned
Keep only the newest keep generations.
pub fn prune_generation(&mut self, prefix: &str) -> Result<Pruned, LockError>
pub fn prune_generation(&mut self, prefix: &str) -> Result<Pruned, LockError>
Remove the one generation whose client contract digest starts with
prefix (at least 8 hex digits).
Trait Implementations§
§impl Clone for ContractLock
impl Clone for ContractLock
§fn clone(&self) -> ContractLock
fn clone(&self) -> ContractLock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ContractLock
impl Debug for ContractLock
§impl Default for ContractLock
impl Default for ContractLock
§fn default() -> ContractLock
fn default() -> ContractLock
§impl<'de> Deserialize<'de> for ContractLock
impl<'de> Deserialize<'de> for ContractLock
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContractLock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContractLock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for ContractLock
§impl PartialEq for ContractLock
impl PartialEq for ContractLock
§impl Serialize for ContractLock
impl Serialize for ContractLock
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ContractLock
Auto Trait Implementations§
impl Freeze for ContractLock
impl RefUnwindSafe for ContractLock
impl Send for ContractLock
impl Sync for ContractLock
impl Unpin for ContractLock
impl UnsafeUnpin for ContractLock
impl UnwindSafe for ContractLock
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<T> MaybeSend for T
impl<T> MaybeSendSync for T
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].