View

Trait View 

Source
pub trait View: 'static {
    // Required method
    fn body(self, _env: &Environment) -> impl View;
}
Expand description

View represents a part of the user interface.

You can create your custom view by implementing this trait. You just need to implement fit.

Users can also create a View using a function that returns another View. This allows for more flexible and composable UI designs.

§Example

use waterui_core::View;

fn greeting() -> impl View {
    "Hello, World!" // &'static str implements View
}

Required Methods§

Source

fn body(self, _env: &Environment) -> impl View

Build this view and return the content.

WARNING: This method should not be called directly by user.

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.

Implementations on Foreign Types§

Source§

impl View for &'static str

Source§

fn body(self, _env: &Environment) -> impl View

Source§

impl View for Cow<'static, str>

Source§

fn body(self, _env: &Environment) -> impl View

Source§

impl View for ()

Source§

fn body(self, _env: &Environment) -> impl View

Source§

impl View for String

Source§

fn body(self, _env: &Environment) -> impl View

Source§

impl<V: View> View for Option<V>

Source§

fn body(self, _env: &Environment) -> impl View

Source§

impl<V: View> View for (V,)

Source§

fn body(self, _env: &Environment) -> impl View

Source§

impl<V: View, E: View> View for Result<V, E>

Source§

fn body(self, _env: &Environment) -> impl View

Implementors§

Source§

impl View for AnyView

Source§

impl View for Dynamic

Source§

impl View for Str

Source§

impl<F: 'static + FnOnce() -> V, V: View> View for F

Source§

impl<T: 'static + NativeView> View for Native<T>

Source§

impl<T: MetadataKey> View for IgnorableMetadata<T>

Source§

impl<T: MetadataKey> View for Metadata<T>

Source§

impl<V, H> View for UseEnv<V, H>
where V: View, H: HandlerOnce<V>,

Source§

impl<V: View> View for Computed<V>
where Self: 'static,

Source§

impl<V: View, T: 'static> View for waterui_core::env::With<V, T>

Source§

impl<V: View, T: 'static> View for waterui_core::With<V, T>