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§
Sourcefn body(self, _env: &Environment) -> impl View
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.