Trait MapRotated
pub trait MapRotated {
type Item;
type Output<I>;
// Required method
fn map_rotated<I>(
self,
start: usize,
f: impl FnMut(Self::Item) -> I,
) -> Self::Output<I>;
}Expand description
Convenience trait that rotates elements in a slice, and maps them to a new value.
Required Associated Types§
type Item
type Item
The items in the slice.
type Output<I>
type Output<I>
The output type of MapRotated::Output.
Required Methods§
fn map_rotated<I>(
self,
start: usize,
f: impl FnMut(Self::Item) -> I,
) -> Self::Output<I>
fn map_rotated<I>( self, start: usize, f: impl FnMut(Self::Item) -> I, ) -> Self::Output<I>
Returns an iterator that maps every value to another value using f, but rotates the results by start positions.
This means that the iterator returns f(self[start]), f(self[start + 1]), .., f(self[0]), f(self[1]), .., f(self[start - 1]).
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.