pub struct ImageProps {
pub src: String,
pub alt: String,
pub aspect_ratio: Option<String>,
pub placeholder_label: Option<String>,
pub inline_svg: Option<String>,
pub data_path: Option<String>,
}Expand description
Props for Image component.
Fields§
§src: String§alt: String§aspect_ratio: Option<String>§placeholder_label: Option<String>Optional label shown in a skeleton placeholder that sits behind the
image. When the image fails to load (or is still being generated),
the <img> is hidden via onerror and the placeholder remains
visible, keeping the container at its aspect-ratio size.
inline_svg: Option<String>Server-rendered inline SVG string. When set, the SVG is emitted verbatim
inside a <div aria-label="{alt}"> wrapper; no <img> tag is produced.
§Safety
Content is NOT sanitized. The SVG string is emitted into the response
verbatim. Pass only server-constructed SVG (e.g. bar charts, QR codes).
Do NOT pass untrusted input. alt is required and is HTML-escaped.
data_path: Option<String>Optional data-path override of src. When set, the renderer resolves
the value at this path against handler data and uses it as the
<img src>. Falls back to src when missing or non-string.
Implementations§
Source§impl ImageProps
impl ImageProps
Sourcepub fn inline_svg(svg: impl Into<String>, alt: impl Into<String>) -> Self
pub fn inline_svg(svg: impl Into<String>, alt: impl Into<String>) -> Self
Convenience constructor for inline-SVG images. src is set to the
empty string; the renderer takes the SVG path when inline_svg is Some.
§Safety
svg is emitted verbatim. See ImageProps::inline_svg for the trust model.
Trait Implementations§
Source§impl Clone for ImageProps
impl Clone for ImageProps
Source§fn clone(&self) -> ImageProps
fn clone(&self) -> ImageProps
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 ImageProps
impl Debug for ImageProps
Source§impl<'de> Deserialize<'de> for ImageProps
impl<'de> Deserialize<'de> for ImageProps
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 ImageProps
Source§impl JsonSchema for ImageProps
impl JsonSchema for ImageProps
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 PartialEq for ImageProps
impl PartialEq for ImageProps
Source§fn eq(&self, other: &ImageProps) -> bool
fn eq(&self, other: &ImageProps) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ImageProps
impl Serialize for ImageProps
impl StructuralPartialEq for ImageProps
Auto Trait Implementations§
impl Freeze for ImageProps
impl RefUnwindSafe for ImageProps
impl Send for ImageProps
impl Sync for ImageProps
impl Unpin for ImageProps
impl UnsafeUnpin for ImageProps
impl UnwindSafe for ImageProps
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.