ViewsExt

Trait ViewsExt 

Source
pub trait ViewsExt: Views {
    // Provided methods
    fn map<F, V>(self, f: F) -> Map<Self, F>
       where Self: Sized,
             F: Fn(Self::View) -> V,
             V: View { ... }
    fn erase(self) -> AnyViews<AnyView>
       where Self: 'static + Sized { ... }
}
Expand description

Extension trait providing additional utilities for types implementing Views.

This trait provides convenient methods for transforming and manipulating view collections, such as mapping views to different types.

Provided Methods§

Source

fn map<F, V>(self, f: F) -> Map<Self, F>
where Self: Sized, F: Fn(Self::View) -> V, V: View,

Transforms each view in the collection using the provided mapping function.

§Parameters
  • f - A function that transforms each view from the source type to a new view type
§Returns

A new Map view collection that applies the transformation to each element

Source

fn erase(self) -> AnyViews<AnyView>
where Self: 'static + Sized,

Erases the specific type of the view collection, returning a type-erased AnyViews.

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.

Implementors§

Source§

impl<T: Views> ViewsExt for T