pub struct AnchorInput {
pub artifact: Option<String>,
pub grain: Option<String>,
pub class: Option<String>,
pub at_version: Option<AnchorVersion>,
pub hash: Option<String>,
pub hash_stability: Option<String>,
pub derived_from: Option<Vec<String>>,
pub binding: Option<String>,
pub source: Option<String>,
}Expand description
A permissive wire-shaped anchor element as it arrives on a mutation’s
anchors[] parameter. All fields are optional / string-typed so an
unknown class or grain surfaces as a typed AnchorValidationError
with recovery detail rather than an opaque serde failure. Call
Self::validate to obtain a strict Anchor.
Fields§
§artifact: Option<String>§grain: Option<String>§class: Option<String>§at_version: Option<AnchorVersion>§hash: Option<String>§hash_stability: Option<String>§derived_from: Option<Vec<String>>§binding: Option<String>§source: Option<String>Implementations§
Source§impl AnchorInput
impl AnchorInput
Sourcepub fn validate(
&self,
medium: Option<(&str, &str)>,
) -> Result<Anchor, AnchorValidationError>
pub fn validate( &self, medium: Option<(&str, &str)>, ) -> Result<Anchor, AnchorValidationError>
Validate this wire element into a strict Anchor, or refuse
typed.
medium — the resolving medium’s (type_name, anchor_namespace)
pair, when the mutation resolved one. When Some, the grain is
checked against the namespace (the capability-matrix refusal);
when None (no medium context — a manually-authored anchor), the
namespace check is skipped and only the vocabulary + hash-semantics
rules apply.
Rules enforced (each a typed AnchorValidationError):
- class present and known;
- grain present and known;
- artifact reference present and non-empty;
- a hash is supplied only on a hash-bearing class;
- hash stability, when supplied, is a known wire string (defaults
to
stablewhen absent); - grain supported by the medium’s namespace (when
mediumgiven).
Trait Implementations§
Source§impl Clone for AnchorInput
impl Clone for AnchorInput
Source§fn clone(&self) -> AnchorInput
fn clone(&self) -> AnchorInput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnchorInput
impl Debug for AnchorInput
Source§impl Default for AnchorInput
impl Default for AnchorInput
Source§fn default() -> AnchorInput
fn default() -> AnchorInput
Source§impl<'de> Deserialize<'de> for AnchorInput
impl<'de> Deserialize<'de> for AnchorInput
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>,
Auto Trait Implementations§
impl Freeze for AnchorInput
impl RefUnwindSafe for AnchorInput
impl Send for AnchorInput
impl Sync for AnchorInput
impl Unpin for AnchorInput
impl UnsafeUnpin for AnchorInput
impl UnwindSafe for AnchorInput
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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