pub struct View<G>where
    G: GenericNode,
{ /* private fields */ }
Expand description

Represents an UI view. Usually constructed using the view! macro or using the builder API.

Example

let my_view: View<G> = view! { cx,
    div {
        p { "A view." }
    }
};

Implementations

Create a new View from a raw node.

Create a new dynamic View from a FnMut.

Create a new View from a FnMut while creating a new child reactive scope.

Create a new View fragment from a Vec of Views.

Create a new View with a blank marker node

Note that this is different from an empty view fragment. Instead, this is a single marker (dummy) node.

Try to cast to a GenericNode, or None if wrong type.

Try to cast to a slice representing the view fragment, or None if wrong type.

Try to cast to the underlying RcSignal for a dynamic view, or None if wrong type.

Returns true if the view is a single node. Note that if the view is a fragment containing only a single child node, this will still return false.

To check whether the View only contains a single node, use .flatten().len() == 1 instead.

Returns true if the view is a view fragment.

Returns true if the view is a dynamic view.

Returns a recursively flattened Vec of raw nodes.

If the current view is dynamic or is a fragment containing dynamic views, the dynamic views will be accessed reactively.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Convert into a View.
Called during the initial render when creating the DOM nodes. Should return a View.

Tautology of converting a View into a View. This allows us to interpolate views into other views.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.