[][src]Struct dodrio::VdomWeak

pub struct VdomWeak { /* fields omitted */ }

A weak handle to a virtual DOM.

Does not prevent the virtual DOM from being unmounted: only keeping the original Vdom alive guarantees that.

A VdomWeak also gives you the capability to scheduling re-rendering (say after mutating the render component state).

Implementations

impl VdomWeak[src]

pub async fn set_component(
    self,
    root: Box<dyn RootRender>
) -> Result<Box<dyn RootRender + 'static>, VdomDroppedError>
[src]

Replace the root rendering component with the new root.

Returns a future that resolves to the old root component.

pub async fn with_component<'_, F, T>(
    &'_ self,
    f: F
) -> Result<T, VdomDroppedError> where
    F: 'static + FnOnce(&mut dyn RootRender) -> T, 
[src]

Execute f with a reference to this virtual DOM's root rendering component.

To ensure exclusive access to the root rendering component, the invocation takes place on a new tick of the micro-task queue.

pub fn schedule_render(&self)[src]

Schedule a render to occur during the next animation frame.

If you want a future that resolves after the render has finished, use render instead.

pub fn render(&self) -> impl Future<Output = Result<(), VdomDroppedError>>[src]

Schedule a render to occur during the next animation frame and return a future that will complete once the render has finished.

If you don't want to do more things after the render completes, then use schedule_render instead of render.

Trait Implementations

impl Clone for VdomWeak[src]

impl Debug for VdomWeak[src]

Auto Trait Implementations

impl !RefUnwindSafe for VdomWeak

impl !Send for VdomWeak

impl !Sync for VdomWeak

impl Unpin for VdomWeak

impl !UnwindSafe for VdomWeak

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> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.