Struct Template Copy item path Source pub struct Template {
pub roots: &'static [TemplateNode ],
pub node_paths: &'static [&'static [u8 ]],
pub attr_paths: &'static [&'static [u8 ]],
}
Expand description A static layout of a UI tree that describes a set of dynamic and static nodes.
This is the core innovation in Dioxus. Most UIs are made of static nodes, yet participate in diffing like any
dynamic node. This struct can be created at compile time. It promises that its name is unique, allow Dioxus to use
its static description of the UI to skip immediately to the dynamic nodes during diffing.
For this to work properly, the [Template::name
] must be unique across your entire project. This can be done via variety of
ways, with the suggested approach being the unique code location (file, line, col, etc).
The list of template nodes that make up the template
Unlike react, calls to rsx!
can have multiple roots. This list supports that paradigm.
The paths of each node relative to the root of the template.
These will be one segment shorter than the path sent to the renderer since those paths are relative to the
topmost element, not the roots
field.
The paths of each dynamic attribute relative to the root of the template
These will be one segment shorter than the path sent to the renderer since those paths are relative to the
topmost element, not the roots
field.
Is this template worth caching at all, since it’s completely runtime?
There’s no point in saving templates that are completely dynamic, since they’ll be recreated every time anyway.
Performs copy-assignment from
source
.
Read more Formats the value using the given formatter.
Read more Compares and returns the maximum of two values.
Read more Compares and returns the minimum of two values.
Read more Restrict a value to a certain interval.
Read more Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
This method returns an ordering between
self
and
other
values if one exists.
Read more Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (for
self
and
other
) and is used by
the
>=
operator.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit
)
Performs copy-assignment from
self
to
dst
.
Read more Returns the argument unchanged.
Instruments this type with the provided
Span
, returning an
Instrumented
wrapper.
Read more Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From <T> for U
chooses to do.
Spawn the value into the dioxus runtime if it is an async block
Convert from a type to another type.
Convert from a type to another type.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.