Skip to main content

MediaMark

Struct MediaMark 

Source
pub struct MediaMark {
    pub kind: MediaKind,
    pub destination: String,
    pub sources: Vec<MediaSource>,
    pub alt: String,
    pub poster: String,
    pub rows: usize,
}
Expand description

The destination and label a block-level media placeholder row carries, so a capable frontend can resolve and paint the real thing. Plain strings (no source offsets), so they survive the row shuffling of BlockCache reuse and build_spliced untouched — see VRow::media.

Fields§

§kind: MediaKind

Whether this is a picture, a movie, or a sound — which widget the frontend builds over the reserved rows.

§destination: String

The media’s link destination — a path, URL, or data: URI, verbatim from the AST. A frontend resolves a relative path against the document’s directory itself; core holds no I/O.

Empty is possible and legal for a <video>/<audio>, which may carry no src of its own and name its candidates in child <source>s instead — unlike an <img>, whose src is the picture. A frontend with an empty destination takes its URL from sources.

§sources: Vec<MediaSource>

A <picture>’s theme/media alternatives, in document order, when this block image came from one; empty for a plain ![](…) / bare <img>. Each is a <source>’s media query + candidate URL(s); a frontend that knows its theme picks the first whose media matches and falls back to destination (the <img>). Core keeps them verbatim and picks nothing — it has no theme.

§alt: String

The media’s alt text (its rendered inline children, flattened), or empty when it has none. Also what the placeholder label shows. For a <video>/ <audio> this is the element’s own text content — the “your browser does not support…” fallback, which doubles as its accessible name.

§poster: String

A <video poster="…">’s still frame, verbatim, or empty when there is none (and always empty for an image or audio). It is an image destination, so a frontend already able to draw a picture can show it before the movie loads — or in place of one it can’t play at all.

§rows: usize

How many visual rows this media reserves — the placeholder label row plus the blank filler rows below it, so a frontend that paints a real raster has the vertical room to draw it. 1 is the bare placeholder (a frontend that can’t draw pictures, or an image it couldn’t resolve). A terminal frontend asks for as many rows as the fitted picture is tall; the pixel-laid-out GUI ignores this and sets its own row height, so it always leaves it 1. The count comes from the frontend (via crate::Doc::set_media_rows) because core does no I/O and can’t measure the image itself. See [VRow::image].

Trait Implementations§

Source§

impl Clone for MediaMark

Source§

fn clone(&self) -> MediaMark

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MediaMark

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MediaMark

Source§

impl PartialEq for MediaMark

Source§

fn eq(&self, other: &MediaMark) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MediaMark

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.