[][src]Struct moxie_dom::MemoElement

pub struct MemoElement { /* fields omitted */ }

A topologically-nested "incremental smart pointer" for an HTML element.

Created during execution of the (element) macro and the element-specific wrappers. Offers a "stringly-typed" API for mutating the contained DOM nodes, adhering fairly closely to the upstream web specs.

Methods

impl MemoElement[src]

pub fn raw_node_that_has_sharp_edges_please_be_careful(&self) -> Node[src]

Retrieves access to the raw HTML element underlying the (MemoElement).

Because this offers an escape hatch around the memoized mutations, it should be used with caution. Also because of this, it has a silly name intended to loudly announce that care must be taken.

Code called by the root function of your application will be run quite frequently and so the tools for memoization are important for keeping your application responsive. If you have legitimate needs for this API, please consider filing an issue with your use case so the maintainers of this crate can consider "official" ways to support it.

pub fn attr(&self, name: &'static str, value: impl ToString) -> &Self[src]

Declare an attribute of the element, mutating the actual element's attribute when the passed value changes.

A guard value is stored as a resulting "effect" of the mutation, and removes the attribute when dropped, to ensure that the attribute is removed when this declaration is no longer referenced in the most recent (moxie::Revision).

pub fn on<Ev>(&self, callback: impl FnMut(Ev) + 'static) -> &Self where
    Ev: 'static + Event
[src]

Declare an event handler on the element.

A guard value is stored as a resulting "effect" of the mutation, and removes the attribute when dropped, to ensure that the attribute is removed when this declaration is no longer referenced in the most recent (moxie::Revision).

Currently this is performed on every Revision, as changes to event handlers don't typically affect the debugging experience and have not yet shown up in performance profiles.

pub fn inner<Ret>(&self, children: impl FnOnce() -> Ret) -> Ret[src]

Declare the inner contents of the element, usually declaring children within the inner scope. After any children have been run and their nodes attached, this clears any trailing child nodes to ensure the element's children are correct per the latest declaration.

Trait Implementations

impl Debug for MemoElement[src]

Auto Trait Implementations

impl !RefUnwindSafe for MemoElement

impl !Send for MemoElement

impl !Sync for MemoElement

impl Unpin for MemoElement

impl !UnwindSafe for MemoElement

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.