[][src]Trait bevy_contrib_inspector::AsHtml

pub trait AsHtml: Sized {
    type Err;
    type Options;

    const DEFAULT_OPTIONS: Self::Options;

    fn as_html(
        shared: SharedOptions<Self>,
        options: Self::Options,
        submit_fn: &'static str
    ) -> String;
fn parse(value: &str) -> Result<Self, Self::Err>; fn header() -> &'static str { ... }
fn footer() -> &'static str { ... } }

controls how a type is rendered in HTML

It also specifies how the type is parsed from a string and what attributes you can apply to it using #[inspector(min = 1, max = 2)]

Associated Types

type Err

The parse error type

type Options

The attibutes you can set for a field

Loading content...

Associated Constants

const DEFAULT_OPTIONS: Self::Options

Default options for the Options-type

Loading content...

Required methods

fn as_html(
    shared: SharedOptions<Self>,
    options: Self::Options,
    submit_fn: &'static str
) -> String

The actual html content.

The options-parameter gives you access to the attributes passed when deriving Inspectable. When there is new input, the submit function should be called with it, for example like this:

format!("<input oninput="{}('new data arrived')" />, submit_fn).

fn parse(value: &str) -> Result<Self, Self::Err>

specifies how the type should be parsed

Loading content...

Provided methods

fn header() -> &'static str

HTML that needs to go to the top of the page, e.g.