Struct Fence

Source
pub struct Fence<D, F> { /* private fields */ }
Expand description

Smart View that guards against unnecessary renders, see fence.

Trait Implementations§

Source§

impl<D, P> Anchor for Fence<D, P>
where P: Mountable,

Source§

type Js = <P as Mountable>::Js

Source§

type Target = P

Source§

fn anchor(&self) -> &P

Source§

impl<D, F, V> View for Fence<D, F>
where D: Diff, F: FnOnce() -> V, V: View,

Source§

type Product = Fence<<D as Diff>::Memo, <V as View>::Product>

The product should contain a DOM reference to this View and any data it needs to update itself.
Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Build a product that can be mounted in the DOM from this type.
Source§

fn update(self, p: &mut Self::Product)

Update the product and apply changes to the DOM if necessary.
Source§

fn on_mount<F>(self, handler: F) -> OnMount<Self, F>
where F: FnOnce(&<Self::Product as Mountable>::Js), Self: Sized,

Once this view is built, do something once.
Source§

fn on_render<F>(self, handler: F) -> OnRender<Self, F>
where F: FnOnce(&<Self::Product as Mountable>::Js), Self: Sized,

Similar to on_mount but triggers on every update, not just initial render.

Auto Trait Implementations§

§

impl<D, F> Freeze for Fence<D, F>
where D: Freeze, F: Freeze,

§

impl<D, F> RefUnwindSafe for Fence<D, F>

§

impl<D, F> Send for Fence<D, F>
where D: Send, F: Send,

§

impl<D, F> Sync for Fence<D, F>
where D: Sync, F: Sync,

§

impl<D, F> Unpin for Fence<D, F>
where D: Unpin, F: Unpin,

§

impl<D, F> UnwindSafe for Fence<D, F>
where D: UnwindSafe, F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Mountable for T
where T: Anchor + 'static, <T as Anchor>::Target: Mountable,

Source§

type Js = <T as Anchor>::Js

The concrete web-sys type representing the root of this product, most often HtmlElement.
Source§

fn js(&self) -> &JsValue

Returns a reference to the root DOM node of this product.
Source§

fn unmount(&self)

Unmount the root of this product from the DOM.
Source§

fn replace_with(&self, new: &JsValue)

Replace the root of this product in the DOM with another.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.