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).
Fields§
§roots: &'static [TemplateNode]
The list of template nodes that make up the template
Unlike react, calls to rsx!
can have multiple roots. This list supports that paradigm.
node_paths: &'static [&'static [u8]]
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.
attr_paths: &'static [&'static [u8]]
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.
Implementations§
Trait Implementations§
source§impl Ord for Template
impl Ord for Template
source§impl PartialOrd for Template
impl PartialOrd for Template
impl Copy for Template
impl Eq for Template
Auto Trait Implementations§
impl Freeze for Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnwindSafe for Template
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)