#[non_exhaustive]pub struct Opaque {
pub reasons: Vec<OpaqueReason>,
pub note: Option<String>,
}Expand description
The record a waiver leaves on one operation.
Serialized under OPAQUE_OPERATION_ANNOTATION. Marks the operation
unverified; never removes it.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.reasons: Vec<OpaqueReason>Every reason recorded, in the order they were recorded, deduplicated.
note: Option<String>Where the waiver was taken, for a human reading the description.
Implementations§
Source§impl Opaque
impl Opaque
Sourcepub fn new(reason: OpaqueReason) -> Self
pub fn new(reason: OpaqueReason) -> Self
A marker carrying one reason.
Sourcepub fn with_reason(self, reason: OpaqueReason) -> Self
pub fn with_reason(self, reason: OpaqueReason) -> Self
Adds a reason, idempotently.
Sourcepub fn absorb(&mut self, other: &Self)
pub fn absorb(&mut self, other: &Self)
Unions other’s reasons into this marker, keeping the first note.
Sourcepub fn is_annotated(operation: &Operation) -> bool
pub fn is_annotated(operation: &Operation) -> bool
Whether operation carries the annotation at all.
True even when the value is malformed, so that a description Kynos cannot read is still treated as unverified rather than as clean.
Sourcepub fn of(operation: &Operation) -> Result<Option<Self>, MalformedAnnotation>
pub fn of(operation: &Operation) -> Result<Option<Self>, MalformedAnnotation>
Reads the marker from an operation.
Ok(None) means the operation carries no marker. A reason this build
does not know is not an error — it round-trips as
OpaqueReason::Unrecognized — so an error here means the value was
hand-written into a shape Kynos never emits.
§Errors
Returns MalformedAnnotation when the annotation is present but
unreadable.
Sourcepub fn apply_to(
&self,
operation: &mut Operation,
) -> Result<(), MalformedAnnotation>
pub fn apply_to( &self, operation: &mut Operation, ) -> Result<(), MalformedAnnotation>
Writes the marker onto an operation, merging with any already present.
§Errors
Returns MalformedAnnotation when the operation already carries an
unreadable marker, rather than replacing it. Overwriting would delete a
waiver someone recorded, which is the one thing this whole mechanism
exists to prevent.
§Panics
Panics only if this marker cannot be serialized, which the type makes impossible.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Opaque
impl<'de> Deserialize<'de> for Opaque
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Opaque
impl StructuralPartialEq for Opaque
Auto Trait Implementations§
impl Freeze for Opaque
impl RefUnwindSafe for Opaque
impl Send for Opaque
impl Sync for Opaque
impl Unpin for Opaque
impl UnsafeUnpin for Opaque
impl UnwindSafe for Opaque
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.