pub struct ImagePayload {
pub src: String,
pub display: ImageDisplay,
pub alt: Option<String>,
pub width: Option<Length>,
pub height: Option<Length>,
pub srcset: Vec<SrcsetCandidate>,
pub anchor: Option<String>,
}Expand description
The payload of flm.pres.image: where the image is, and how it is to be
presented. The node has no content.
The display says whether the image is a block of its own (as the content
of a float) or inline in the text around it (ImageDisplay).
The two dimensions are the size the image is shown at, each a Length
kept in the unit it was given in; each backend writes them its own way (the
page as two custom properties its stylesheet reads, LaTeX through its
length writer) and none converts them. A dimension left out is the image’s
natural size in that direction, the image keeping its proportions; where
both are set, the image is shown at exactly that size.
Fields§
§src: StringThe image source, as the backend’s published graphics table resolved it.
display: ImageDisplayBlock or inline.
alt: Option<String>The alternative text, when given.
width: Option<Length>The width the image is shown at, when set.
height: Option<Length>The height the image is shown at, when set.
srcset: Vec<SrcsetCandidate>Alternative sources.
anchor: Option<String>The anchor, when the image is a link target.
Implementations§
Source§impl ImagePayload
impl ImagePayload
Sourcepub fn from_projection(
value: &SerialValue,
) -> Result<ImagePayload, DeserializeError>
pub fn from_projection( value: &SerialValue, ) -> Result<ImagePayload, DeserializeError>
The payload rebuilt from its projection, the value
project produced.
§Errors
Returns a DeserializeError mentioning flm.pres.image when the
projection is not a map, when src is missing, when display is
missing or matches no display (ImageDisplay::parse), when alt or anchor
is present and is not a string, when width or height is present
and is not the text of a length (Length::parse), or when srcset
is present and is not a list of maps each holding a src and a
descriptor string.
Trait Implementations§
Source§impl Clone for ImagePayload
impl Clone for ImagePayload
Source§impl Debug for ImagePayload
impl Debug for ImagePayload
Source§impl Default for ImagePayload
impl Default for ImagePayload
impl Eq for ImagePayload
Source§impl PartialEq for ImagePayload
impl PartialEq for ImagePayload
Source§impl PresPayload for ImagePayload
impl PresPayload for ImagePayload
Source§fn project(&self) -> SerialValue
fn project(&self) -> SerialValue
impl StructuralPartialEq for ImagePayload
Auto Trait Implementations§
impl Forget for ImagePayload
impl Freeze for ImagePayload
impl Move for ImagePayload
impl RefUnwindSafe for ImagePayload
impl Send for ImagePayloadwhere
RawVecInner: Send,
impl Sync for ImagePayloadwhere
RawVecInner: Sync,
impl Unpin for ImagePayload
impl UnsafeUnpin for ImagePayloadwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>>: UnsafeUnpin,
PhantomData<SrcsetCandidate>: UnsafeUnpin,
impl UnwindSafe for ImagePayloadwhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more