#[non_exhaustive]pub struct ResourceInfo {
pub url: CompactString,
pub description: Option<CompactString>,
pub mime_type: Option<CompactString>,
pub service_name: Option<CompactString>,
pub tags: Vec<CompactString>,
pub icon_url: Option<CompactString>,
}Expand description
Human-readable metadata describing the paid resource.
Per the x402 v2 spec §5.1.2, only url is required. description and
mimeType are optional because many resources (e.g. raw API endpoints)
have no meaningful MIME type or prose description. serviceName,
tags, and iconUrl are optional discovery metadata consumed by
marketplace/bazaar-style aggregators.
The field names use camelCase to align with the wire format.
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.url: CompactStringCanonical URL of the resource.
description: Option<CompactString>Optional human-readable description.
mime_type: Option<CompactString>Optional MIME type.
service_name: Option<CompactString>Human-readable name of the service hosting the resource.
Printable ASCII, max 32 characters per spec §5.1.2.
Topical tags for the service, used for discovery filtering.
Max 5 entries; each printable ASCII, max 32 characters, per spec §5.1.2.
icon_url: Option<CompactString>Absolute https/http URL to an icon representing the service.
Max 2048 characters per spec §5.1.2.
Implementations§
Source§impl ResourceInfo
impl ResourceInfo
Sourcepub fn new(url: impl Into<CompactString>) -> Self
pub fn new(url: impl Into<CompactString>) -> Self
Constructs a ResourceInfo carrying just a URL.
Sourcepub fn with_description(self, description: impl Into<CompactString>) -> Self
pub fn with_description(self, description: impl Into<CompactString>) -> Self
Builder: sets description.
Sourcepub fn with_mime_type(self, mime_type: impl Into<CompactString>) -> Self
pub fn with_mime_type(self, mime_type: impl Into<CompactString>) -> Self
Builder: sets mimeType.
Sourcepub fn with_service_name(self, service_name: impl Into<CompactString>) -> Self
pub fn with_service_name(self, service_name: impl Into<CompactString>) -> Self
Builder: sets serviceName.
Builder: replaces the tags list.
Sourcepub fn with_tag(self, tag: impl Into<CompactString>) -> Self
pub fn with_tag(self, tag: impl Into<CompactString>) -> Self
Builder: appends a single tag.
Sourcepub fn with_icon_url(self, icon_url: impl Into<CompactString>) -> Self
pub fn with_icon_url(self, icon_url: impl Into<CompactString>) -> Self
Builder: sets iconUrl.
Trait Implementations§
Source§impl Clone for ResourceInfo
impl Clone for ResourceInfo
Source§fn clone(&self) -> ResourceInfo
fn clone(&self) -> ResourceInfo
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 ResourceInfo
impl Debug for ResourceInfo
Source§impl<'de> Deserialize<'de> for ResourceInfo
impl<'de> Deserialize<'de> for ResourceInfo
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 ResourceInfo
Source§impl PartialEq for ResourceInfo
impl PartialEq for ResourceInfo
Source§impl Serialize for ResourceInfo
impl Serialize for ResourceInfo
impl StructuralPartialEq for ResourceInfo
Auto Trait Implementations§
impl Freeze for ResourceInfo
impl RefUnwindSafe for ResourceInfo
impl Send for ResourceInfo
impl Sync for ResourceInfo
impl Unpin for ResourceInfo
impl UnsafeUnpin for ResourceInfo
impl UnwindSafe for ResourceInfo
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.