Skip to main content

TrustTaskCode

Enum TrustTaskCode 

Source
pub enum TrustTaskCode {
    Standard(StandardCode),
    Extended {
        slug: String,
        local: String,
    },
}
Expand description

An error code — either a framework-standard code (SPEC.md §8.3) or an extension code namespaced by a spec’s slug (SPEC.md §8.5).

Variants§

§

Standard(StandardCode)

One of the framework-defined codes recognized by every conforming consumer.

§

Extended

A specification-extended code in the form <slug>:<local>.

The code names a slug but no authority, so it means something only against the Type URI of the request it answers (SPEC.md §8.5): vault/get:notFound from the registry’s vault/get and from a private one are different codes. Resolve it with inResponseTo.typeUri (or the request you sent), never by the string alone, and keep that Type URI beside it anywhere the code outlives the exchange.

Fields

§slug: String

The slug owning this extension, e.g. "trust-task-control" or "acl/grant".

§local: String

The local code identifier within the slug’s namespace.

Implementations§

Source§

impl TrustTaskCode

Source

pub fn new_extended( slug: impl Into<String>, local: impl Into<String>, ) -> Result<Self, ParseCodeError>

Construct an extended code <slug>:<local> after validating both halves against SPEC.md §8.5’s grammar (slug per §6.1, local per spec.meta.schema.json’s errorCodes[].code pattern after the colon). Returns ParseCodeError when either is malformed.

Round-trips cleanly through Display and FromStr — a guarantee the hand-rolled struct-literal form (TrustTaskCode::Extended { slug, local }) does not enforce.

Trait Implementations§

Source§

impl Clone for TrustTaskCode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TrustTaskCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TrustTaskCode
where Self: FromStr, <Self as FromStr>::Err: Display,

Source§

fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TrustTaskCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TrustTaskCode

Source§

impl From<DeclaredErrorCode> for TrustTaskCode

Source§

fn from(declared: DeclaredErrorCode) -> Self

Infallible: the generator refuses to emit a code that does not parse, so a DeclaredErrorCode from crate::specs always converts.

Source§

impl From<StandardCode> for TrustTaskCode

Source§

fn from(code: StandardCode) -> Self

Converts to this type from the input type.
Source§

impl From<TrustTaskCode> for ErrorPayload

Source§

fn from(code: TrustTaskCode) -> Self

Converts to this type from the input type.
Source§

impl FromStr for TrustTaskCode

Source§

type Err = ParseCodeError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for TrustTaskCode

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TrustTaskCode
where Self: Display,

Source§

fn serialize<__S>(&self, serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TrustTaskCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.