PageContent

Enum PageContent 

Source
pub enum PageContent {
    Url(String, Option<PageContext>),
    Text(String),
    Image(ImageRefPriv),
    Zip(String, String),
}
Expand description

The content of a page.

Variants§

§

Url(String, Option<PageContext>)

A url to an image, with associated context.

The context is sent to the page processor and/or image request modifier if the source implements either.

§

Text(String)

A markdown text string.

§

Image(ImageRefPriv)

A raw image.

§

Zip(String, String)

A url to zip archive and a file path to an image inside the archive.

Implementations§

Source§

impl PageContent

Source

pub fn url<T: Into<String>>(url: T) -> Self

Create a new PageContent with a url.

Source

pub fn url_context<T: Into<String>>(url: T, context: PageContext) -> Self

Create a new PageContent with a url and context.

Source

pub fn text<T: Into<String>>(text: T) -> Self

Create a new PageContent with a markdown text string.

Source

pub fn image(image: ImageRef) -> Self

Create a new PageContent with a raw image.

Trait Implementations§

Source§

impl Debug for PageContent

Source§

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

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

impl<'de> Deserialize<'de> for PageContent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for PageContent

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PageContent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PageContent

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> 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, 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,