pub struct Icon {
pub src: Option<String>,
pub mime_type: Option<String>,
pub sizes: Option<String>,
}Expand description
Icon metadata for visual representation of components.
Icons provide visual representation for tools, resources, and prompts in client UIs. All fields are optional to support various use cases.
Fields§
§src: Option<String>URL or data URI for the icon.
Can be:
- HTTP/HTTPS URL:
https://example.com/icon.png - Data URI:
data:image/png;base64,iVBORw0KGgo...
mime_type: Option<String>MIME type of the icon (e.g., “image/png”, “image/svg+xml”).
sizes: Option<String>Size hints for the icon (e.g., “32x32”, “16x16 32x32 64x64”).
Implementations§
Source§impl Icon
impl Icon
Sourcepub fn with_mime_type(
src: impl Into<String>,
mime_type: impl Into<String>,
) -> Self
pub fn with_mime_type( src: impl Into<String>, mime_type: impl Into<String>, ) -> Self
Creates a new icon with source and MIME type.
Sourcepub fn full(
src: impl Into<String>,
mime_type: impl Into<String>,
sizes: impl Into<String>,
) -> Self
pub fn full( src: impl Into<String>, mime_type: impl Into<String>, sizes: impl Into<String>, ) -> Self
Creates a new icon with all fields.
Sourcepub fn is_data_uri(&self) -> bool
pub fn is_data_uri(&self) -> bool
Returns true if the source is a data URI.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Icon
impl<'de> Deserialize<'de> for Icon
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Icon
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 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).