pub struct ForEach<C, F, V>{ /* private fields */ }Expand description
A utility for transforming elements of a collection with a mapping function.
ForEach applies a transformation function to each element of a source collection,
producing a new collection with the transformed elements. This is useful for
transforming data models into view representations.
Implementations§
Source§impl<C, F, V> ForEach<C, F, V>
impl<C, F, V> ForEach<C, F, V>
Sourcepub const fn new(data: C, generator: F) -> Self
pub const fn new(data: C, generator: F) -> Self
Creates a new ForEach transformation with the provided data collection and generator function.
§Parameters
data- The source collection containing elements to be transformedgenerator- A function that transforms elements from the source collection
§Returns
A new ForEach instance that will apply the transformation when accessed
Sourcepub fn into_inner(self) -> (C, F)
pub fn into_inner(self) -> (C, F)
Consumes the ForEach and returns the original data collection and generator function.
§Returns
A tuple containing the original data collection and generator function
Trait Implementations§
Source§impl<C, F, V> Collection for ForEach<C, F, V>
impl<C, F, V> Collection for ForEach<C, F, V>
Source§type Item = <<C as Collection>::Item as Identifiable>::Id
type Item = <<C as Collection>::Item as Identifiable>::Id
The type of items stored in the collection.
Source§type Guard = <C as Collection>::Guard
type Guard = <C as Collection>::Guard
The type of guard returned when registering a watcher.
Source§fn get(&self, index: usize) -> Option<Self::Item>
fn get(&self, index: usize) -> Option<Self::Item>
Gets an item from the collection at the specified index.
Source§impl<C, F, V> Views for ForEach<C, F, V>
impl<C, F, V> Views for ForEach<C, F, V>
Source§type Id = <<C as Collection>::Item as Identifiable>::Id
type Id = <<C as Collection>::Item as Identifiable>::Id
The type of unique identifier for items in the collection.
Must implement
Hash and Ord to ensure uniqueness and ordering.Source§type Guard = <C as Collection>::Guard
type Guard = <C as Collection>::Guard
The type of guard returned when registering a watcher.
Source§fn get_id(&self, index: usize) -> Option<Self::Id>
fn get_id(&self, index: usize) -> Option<Self::Id>
Returns the unique identifier for the item at the specified index, or
None if out of bounds.Source§fn get_view(&self, index: usize) -> Option<Self::View>
fn get_view(&self, index: usize) -> Option<Self::View>
Returns the view at the specified index, or
None if the index is out of bounds.Auto Trait Implementations§
impl<C, F, V> Freeze for ForEach<C, F, V>
impl<C, F, V> RefUnwindSafe for ForEach<C, F, V>where
C: RefUnwindSafe,
F: RefUnwindSafe,
impl<C, F, V> Send for ForEach<C, F, V>
impl<C, F, V> Sync for ForEach<C, F, V>
impl<C, F, V> Unpin for ForEach<C, F, V>
impl<C, F, V> UnwindSafe for ForEach<C, F, V>where
C: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more