Object

Enum Object 

Source
pub enum Object {
    Text(Line, RenderData),
    Paragraph(Line),
    Choice(PageKey, Vec<(u8, Line)>),
    Image(Image),
    Heading(Span, u8),
    Break,
    Empty(u8),
    Note(Line, (u8, u8)),
    Quote(Line, RenderData),
    Custom(RenderData),
}
Expand description

An object within a View.

The frontend is responsible for the display of each variant, but should adhere to their description in doing so.

Variants§

§

Text(Line, RenderData)

A single line, rendered with wrapping, carrying optional data which can be used for customization by the frontend.

N.B. spans are allowed to carry newlines.

§

Paragraph(Line)

Text with a single-spaced y-margin.

§

Choice(PageKey, Vec<(u8, Line)>)

A list of selectable texts which stores the selected index on click.

Like the paragraph variant, this includes a single-spaced y-margin

§

Image(Image)

See Image

§

Heading(Span, u8)

Markdown heading

§

Break

Horizontal line <hr/>

§

Empty(u8)

empty lines.

§

Note(Line, (u8, u8))

Represents different types of notes.

Inputs:

  • Line: The content to display.
  • (u8, u8): Indices into a Span from View[Line[Span]], e.g., for annotations.
§

Quote(Line, RenderData)

Quote style.

§

Custom(RenderData)

Custom marker. For example, can be used signal to the frontend to play music when this object enters the screen.

Trait Implementations§

Source§

impl Clone for Object

Source§

fn clone(&self) -> Object

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Object

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Object

§

impl !RefUnwindSafe for Object

§

impl Send for Object

§

impl Sync for Object

§

impl Unpin for Object

§

impl !UnwindSafe for Object

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V