#[non_exhaustive]pub struct Icon {
pub src: String,
pub mime_type: Option<MediaType>,
pub sizes: Option<Vec<String>>,
pub theme: Option<IconTheme>,
pub meta: Option<Map<String, Value>>,
}unstable_protocol_v2 only.Expand description
An optionally-sized icon that can be displayed in a user interface.
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.src: StringA standard URI pointing to an icon resource.
mime_type: Option<MediaType>Optional MIME type override if the source MIME type is missing or generic.
Omitted and null are equivalent and mean the source MIME type is used.
sizes: Option<Vec<String>>Optional array of strings that specify sizes at which the icon can be used.
Each string should be in WxH format (e.g., "48x48", "96x96") or
"any" for scalable formats like SVG.
If not provided, the client should assume that the icon can be used at any size.
Omitted and null are equivalent and mean no sizes are specified.
theme: Option<IconTheme>Optional theme this icon is designed for.
Omitted and null are equivalent and mean the icon is not theme-specific.
meta: Option<Map<String, Value>>The _meta property is reserved by ACP to allow clients and agents to attach additional
metadata to their interactions. Omitted and null are equivalent and mean no metadata.
Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Implementations§
Source§impl Icon
impl Icon
Sourcepub fn new(src: impl Into<String>) -> Icon
pub fn new(src: impl Into<String>) -> Icon
Builds Icon with the required source URI; optional display hints start unset.
Sourcepub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> Icon
pub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> Icon
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Sourcepub fn mime_type(self, mime_type: impl IntoOption<MediaType>) -> Icon
pub fn mime_type(self, mime_type: impl IntoOption<MediaType>) -> Icon
Sets or clears the optional mimeType field.
Sourcepub fn sizes(self, sizes: impl IntoOption<Vec<String>>) -> Icon
pub fn sizes(self, sizes: impl IntoOption<Vec<String>>) -> Icon
Sets or clears the optional sizes at which the icon can be used.
Sourcepub fn theme(self, theme: impl IntoOption<IconTheme>) -> Icon
pub fn theme(self, theme: impl IntoOption<IconTheme>) -> Icon
Sets or clears the optional theme field.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Icon
impl<'de> Deserialize<'de> for Icon
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Icon, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Icon, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Icon
Source§impl JsonSchema for Icon
impl JsonSchema for Icon
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Serialize for Icon
impl Serialize for Icon
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 Icon
Auto Trait Implementations§
impl Freeze for Icon
impl RefUnwindSafe for Icon
impl Send for Icon
impl Sync for Icon
impl Unpin for Icon
impl UnsafeUnpin for Icon
impl UnwindSafe for Icon
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§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.