Trait Mountable
pub trait Mountable {
// Required methods
fn unmount(&mut self);
fn mount(&mut self, parent: &Element, marker: Option<&Node>);
fn insert_before_this(&self, child: &mut dyn Mountable) -> bool;
fn elements(&self) -> Vec<Element>;
// Provided methods
fn try_mount(&mut self, parent: &Element, marker: Option<&Node>) -> bool { ... }
fn insert_before_this_or_marker(
&self,
parent: &Element,
child: &mut dyn Mountable,
marker: Option<&Node>,
) { ... }
}
Expand description
Allows a type to be mounted to the DOM.
Required Methodsยง
fn unmount(&mut self)
fn unmount(&mut self)
Detaches the view from the DOM.
fn insert_before_this(&self, child: &mut dyn Mountable) -> bool
fn insert_before_this(&self, child: &mut dyn Mountable) -> bool
Inserts another Mountable
type before this one. Returns false
if
this does not actually exist in the UI (for example, ()
).
Provided Methodsยง
fn try_mount(&mut self, parent: &Element, marker: Option<&Node>) -> bool
fn try_mount(&mut self, parent: &Element, marker: Option<&Node>) -> bool
Mounts a node to the interface. Returns false
if it could not be mounted.
fn insert_before_this_or_marker(
&self,
parent: &Element,
child: &mut dyn Mountable,
marker: Option<&Node>,
)
fn insert_before_this_or_marker( &self, parent: &Element, child: &mut dyn Mountable, marker: Option<&Node>, )
Inserts another Mountable
type before this one, or before the marker
if this one doesnโt exist in the UI (for example, ()
).