Enum Constraint
pub enum Constraint {
Known {
known: KnownConstraint,
extra: Map<String, Value>,
},
Unknown {
constraint_type: String,
fields: Map<String, Value>,
},
}Expand description
A constraint carried by an L2 open mandate.
The constraint model is extensible: implementations define their own types, and the registered set grows over time, so a verifier will meet tags newer than itself. An unrecognized constraint is kept verbatim rather than failing the whole evaluation at parse time, so that a strictness policy can decide what it means. The specification requires that every field of such a constraint survive parsing.
Variants§
Known
A constraint type this build can evaluate.
Fields
known: KnownConstraintThe recognized constraint.
extra: Map<String, Value>Fields the recognized variant did not consume.
Preservation is required of every constraint object, not only of unrecognized types: a newer issuer may add a field to a type this build already knows, and a stage that reads the constraint later cannot recover what this parser discarded. The reference implementation carries the same thing on every constraint class.
Unknown
A constraint type this build does not recognize, preserved in full.
Trait Implementations§
Source§impl Clone for Constraint
impl Clone for Constraint
Source§fn clone(&self) -> Constraint
fn clone(&self) -> Constraint
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Constraint
impl Debug for Constraint
Source§impl<'de> Deserialize<'de> for Constraint
impl<'de> Deserialize<'de> for Constraint
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Constraint, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Constraint, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for Constraint
Source§impl From<KnownConstraint> for Constraint
impl From<KnownConstraint> for Constraint
Source§fn from(known: KnownConstraint) -> Constraint
fn from(known: KnownConstraint) -> Constraint
Wrap a recognized constraint that carries no additional fields.
This is a convenience over the recognized representation and asserts nothing about verification. The opaque verified types deliberately have no such conversion.
Source§impl PartialEq for Constraint
impl PartialEq for Constraint
Source§impl Serialize for Constraint
impl Serialize for Constraint
Source§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,
Emit the constraint, refusing any value whose serialized form is a different constraint from the one in hand.
The recognized value comes from the parser and the preserved fields come from the caller, so the two can disagree. There are four ways, and all of them are reachable only from a hand-built value, since the parser derives its preserved set from whatever the recognized value did not consume:
- a preserved field named after one the variant emits,
- a preserved
typeon the unrecognized arm, - a preserved field named after one the variant omits, which
skip_serializing_ifkeeps out of the emitted object entirely, - an unrecognized constraint carrying a tag this build does recognize, whose bytes parse back as the recognized variant.
The first two are refused by name while the object is built. The last two are invisible to a name check, so the rule is applied to the result instead: parse the emitted bytes back and compare what a checker would read. Stating it once over the whole type is what keeps the next variation from having to be foreseen.
This matters because the issuance path is public and signs what it is handed. A mismatch here puts a constraint into a signed mandate that no checker ever evaluated, and the fourth case does so in the direction that fails open.
impl StructuralPartialEq for Constraint
Auto Trait Implementations§
impl Freeze for Constraint
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnsafeUnpin for Constraint
impl UnwindSafe for Constraint
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<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