pub struct Image<'a> {
pub alt: &'a str,
pub caption: Option<&'a str>,
pub fit: Fit,
pub intrinsic: Option<Extent>,
pub loading: Loading,
}Expand description
A picture, and what it says to someone who is not looking at it.
§No source
Act’s split, for Act’s reason. A source is an address, and this
crate has no notion of an address: it says what a thing is and the caller
keeps what it points at. The three findings dropped from 0.11.0 were all
this same shape.
It matters more here than it does for a control, because a picture is the
one member where the address is most of what a webview needs and none of
what the description knows. quasi_router::Node::Image carries the URL, the
way it carries an Action for a control.
§Why alt is not optional
Every other host has to draw something, and for two of the three the alt text is not a fallback but the whole rendering: a terminal without a graphics protocol has the words and nothing else. Making it optional would make “this picture is invisible on a terminal” the default, and the description would be carrying a webview assumption in its shape.
An image that genuinely says nothing — a rule, a spacer, a decoration
repeating what the text beside it already said — is an empty alt, which is
the same thing HTML means by it and is a claim rather than an oversight.
Fields§
§alt: &'a strWhat the picture says, for anything not showing it.
Empty means the picture is decorative and adds nothing to the text
around it. See the type’s own docs on why this is not an Option.
caption: Option<&'a str>A visible line under the picture, where the app wants one.
Distinct from alt and the difference is who it is for: a
caption is content everybody reads, alt text is what stands in for the
picture. A screenshot captioned “The library view” still needs alt text
describing what is in the shot.
fit: FitHow it sits in the box it is given.
intrinsic: Option<Extent>The picture’s own dimensions, where the app knows them.
Not a display size, and that distinction is what makes this belong
here rather than fall foul of the deferral rule. Saying a picture should
be 320 points wide is a layout value and is not the description’s to
give. Saying the file is 5120x3412 is a fact about the picture, the
same kind of fact alt is, and no renderer can find it out
without fetching the bytes.
§What it is for, and it is not decoration
Without it a renderer cannot reserve room, so the picture occupies nothing until it arrives and then takes its full height at once, shoving everything below it down the screen. Measured on MNW’s landing page 2026-08-14: a 478px jump per frame, and a cumulative layout shift of 0.087 for the page, which is most of the way to the 0.1 that counts as bad.
Every host wants it and none can derive it. A webview writes width and
height so the browser holds the space; egui sizes a texture; a
terminal with a graphics protocol scales a blit into cells. This was
missing from 0.21.0, which is the release that added Image, and its
absence is the defect rather than an omission.
None is honest and common: a creator-uploaded image whose dimensions
the app never recorded genuinely does not know. It means the renderer
cannot reserve, not that the picture has no size.
loading: LoadingWhether the picture is needed with the screen, or can arrive later.
Implementations§
Source§impl<'a> Image<'a>
impl<'a> Image<'a>
Sourcepub const fn intrinsic(self, width: u32, height: u32) -> Self
pub const fn intrinsic(self, width: u32, height: u32) -> Self
The picture’s own dimensions, so a renderer can hold its place.
Sourcepub const fn lazy(self) -> Self
pub const fn lazy(self) -> Self
This picture is not on screen yet; it can arrive when it is near.
Sourcepub const fn speaks(self) -> bool
pub const fn speaks(self) -> bool
Whether the picture adds anything for someone not looking at it.
A renderer with no way to show a picture uses this to decide between drawing the alt text and drawing nothing at all. Both are correct and the difference is this flag: standing in for a decorative rule with the word “decoration” is worse than leaving the space empty.