pub trait IntoView: Sized {
type V: View + 'static;
type Intermediate: HasViewId + IntoView<V = Self::V>;
// Required method
fn into_intermediate(self) -> Self::Intermediate;
// Provided methods
fn into_view(self) -> Self::V { ... }
fn into_any(self) -> AnyView { ... }
}Expand description
Converts a value into a View.
This trait can be implemented on types which can be built into another type that implements the View trait.
For example, &str implements IntoView by building a text view and can therefore be used directly in a View tuple.
fn app_view() -> impl IntoView {
v_stack(("Item One", "Item Two"))
}Check out the other types that IntoView is implemented for.
Required Associated Types§
Sourcetype Intermediate: HasViewId + IntoView<V = Self::V>
type Intermediate: HasViewId + IntoView<V = Self::V>
Intermediate type that has a ViewId before full view construction.
For View types, this is Self (already has ViewId).
For primitives, this is LazyView<Self> (creates ViewId, defers view construction).
For tuples/vecs, this is the converted view type (eager conversion).
Required Methods§
Sourcefn into_intermediate(self) -> Self::Intermediate
fn into_intermediate(self) -> Self::Intermediate
Converts to the intermediate form which has a ViewId.
This is used by Decorators to get a ViewId
for applying styles before the final view is constructed.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.