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.
Implementations§
Source§impl TrustTaskCode
impl TrustTaskCode
Sourcepub fn new_extended(
slug: impl Into<String>,
local: impl Into<String>,
) -> Result<Self, ParseCodeError>
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
impl Clone for TrustTaskCode
Source§impl Debug for TrustTaskCode
impl Debug for TrustTaskCode
Source§impl<'de> Deserialize<'de> for TrustTaskCode
impl<'de> Deserialize<'de> for TrustTaskCode
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>,
Source§impl Display for TrustTaskCode
impl Display for TrustTaskCode
impl Eq for TrustTaskCode
Source§impl From<DeclaredErrorCode> for TrustTaskCode
impl From<DeclaredErrorCode> for TrustTaskCode
Source§fn from(declared: DeclaredErrorCode) -> Self
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
impl From<StandardCode> for TrustTaskCode
Source§fn from(code: StandardCode) -> Self
fn from(code: StandardCode) -> Self
Source§impl From<TrustTaskCode> for ErrorPayload
impl From<TrustTaskCode> for ErrorPayload
Source§fn from(code: TrustTaskCode) -> Self
fn from(code: TrustTaskCode) -> Self
Source§impl FromStr for TrustTaskCode
impl FromStr for TrustTaskCode
Source§impl PartialEq for TrustTaskCode
impl PartialEq for TrustTaskCode
Source§impl Serialize for TrustTaskCodewhere
Self: Display,
impl Serialize for TrustTaskCodewhere
Self: Display,
impl StructuralPartialEq for TrustTaskCode
Auto Trait Implementations§
impl Forget for TrustTaskCode
impl Freeze for TrustTaskCode
impl Move for TrustTaskCode
impl RefUnwindSafe for TrustTaskCode
impl Send for TrustTaskCode
impl Sync for TrustTaskCode
impl Unpin for TrustTaskCode
impl UnsafeUnpin for TrustTaskCode
impl UnwindSafe for TrustTaskCode
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>,
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.