pub struct MediaSource {
pub media: String,
pub srcset: String,
pub mime: String,
}Expand description
One <source> under a <picture>, <video>, or <audio>: a candidate URL
plus whichever of the two things HTML lets a <source> be chosen by — a
media query (<picture>) or a MIME type (<video>/<audio>). Verbatim from
the AST: core carries the alternatives and resolves none of them, having
neither a theme nor a codec list to judge them by.
The two spellings are normalised onto one field. <picture> writes
srcset, <video>/<audio> write src; both land in
srcset, since a frontend wants the URL either way
and only <picture> ever uses the descriptor syntax.
Fields§
§media: StringThe <source media="…"> query, verbatim ("(prefers-color-scheme: dark)"),
or empty for a <source> with no media (an unconditional override, and
the norm for <video>/<audio>, which pick by codec rather than theme).
srcset: StringThe candidate URL(s): a <picture>’s srcset verbatim — one URL, or a
comma-separated candidate list with 1x/2x/width descriptors — or a
<video>/<audio> <source>’s plain src. A frontend takes the first
URL token; the theme and codec cases both only ever need that.
mime: StringThe <source type="…"> MIME type ("video/webm"), verbatim, or empty
when the <source> declares none. How a <video>/<audio> frontend
picks a candidate it can actually decode; a <picture>’s sources
normally leave it empty and are chosen by media.
Trait Implementations§
Source§impl Clone for MediaSource
impl Clone for MediaSource
Source§fn clone(&self) -> MediaSource
fn clone(&self) -> MediaSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more