pub struct TypeUri { /* private fields */ }Expand description
Parsed Trust Task Type URI.
Round-trips through FromStr and fmt::Display and serializes as a
single JSON string via SerializeDisplay / DeserializeFromStr.
Implementations§
Source§impl TypeUri
impl TypeUri
Sourcepub fn canonical(
slug: impl Into<String>,
major: u32,
minor: u32,
) -> Result<TypeUri, ParseTypeUriError>
pub fn canonical( slug: impl Into<String>, major: u32, minor: u32, ) -> Result<TypeUri, ParseTypeUriError>
Build a TypeUri from its components on the canonical
https://trusttasks.org/ authority.
Sourcepub fn new(
authority: impl Into<String>,
slug: impl Into<String>,
major: u32,
minor: u32,
variant: Option<Variant>,
) -> Result<TypeUri, ParseTypeUriError>
pub fn new( authority: impl Into<String>, slug: impl Into<String>, major: u32, minor: u32, variant: Option<Variant>, ) -> Result<TypeUri, ParseTypeUriError>
Build a TypeUri from its components.
authority is the scheme + host + optional port + optional /spec-stripped
prefix — i.e. everything before /spec/<slug>/<version> in the final URI.
Sourcepub fn variant(&self) -> Option<Variant>
pub fn variant(&self) -> Option<Variant>
The variant fragment, if any. A missing fragment is semantically
equivalent to Variant::Request per SPEC §4.4.1.
Sourcepub fn is_response(&self) -> bool
pub fn is_response(&self) -> bool
Returns true if this URI identifies the success-response variant.
Sourcepub fn bare(&self) -> TypeUri
pub fn bare(&self) -> TypeUri
Returns a copy of this URI with the fragment stripped — the form used to dereference the schema.
Sourcepub fn for_routing(&self) -> TypeUri
pub fn for_routing(&self) -> TypeUri
Returns a copy of this URI in its routing canonical form, per
SPEC.md §4.4.1 item 1 (“no fragment” and #request are semantically
equivalent). Used by crate::Dispatcher so that producers emitting
either form route to the same handler.
Variant::RequestandNonecollapse toNone.Variant::Responseis preserved.
Sourcepub fn with_response(&self) -> TypeUri
pub fn with_response(&self) -> TypeUri
Returns a copy of this URI with the fragment set to #response,
per SPEC.md §4.4.1. Used when minting a success-response document
against a known request URI.
Sourcepub fn with_request(&self) -> TypeUri
pub fn with_request(&self) -> TypeUri
Returns a copy of this URI with the fragment set to #request. The
bare form (no fragment) is semantically equivalent — prefer
bare unless you need the fragment to be explicit.
Sourcepub fn with_variant(&self, v: Option<Variant>) -> TypeUri
pub fn with_variant(&self, v: Option<Variant>) -> TypeUri
Returns a copy of this URI with variant set to v (or stripped
when v is None).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TypeUri
impl<'de> Deserialize<'de> for TypeUri
Source§fn deserialize<__D>(
deserializer: __D,
) -> Result<TypeUri, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
deserializer: __D,
) -> Result<TypeUri, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for TypeUri
Source§impl Serialize for TypeUri
impl Serialize for TypeUri
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,
impl StructuralPartialEq for TypeUri
Auto Trait Implementations§
impl Freeze for TypeUri
impl RefUnwindSafe for TypeUri
impl Send for TypeUri
impl Sync for TypeUri
impl Unpin for TypeUri
impl UnsafeUnpin for TypeUri
impl UnwindSafe for TypeUri
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> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
Source§impl<T> CallHasher for T
impl<T> CallHasher for 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<'de, T, C> DeserializeTyped<'de, C> for Twhere
T: Deserialize<'de>,
impl<'de, T, C> DeserializeTyped<'de, C> for Twhere
T: Deserialize<'de>,
fn deserialize_typed<S>(
_: &C,
deserializer: S,
) -> Result<T, <S as Deserializer<'de>>::Error>where
S: Deserializer<'de>,
impl<T, U> DeserializeTypedOwned<T> for Uwhere
U: for<'de> DeserializeTyped<'de, T>,
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.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
fn equivalent(&self, key: &K) -> bool
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.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ResourceProvider<()> for T
impl<T> ResourceProvider<()> for T
Source§fn get_resource(&self) -> &()
fn get_resource(&self) -> &()
T.