pub trait BoundedMap<T, N: Get<u32>> {
// Required methods
fn map<U>(self, f: impl FnMut(T) -> U) -> BoundedVec<U, N>;
fn map_ref<U>(&self, f: impl FnMut(&T) -> U) -> BoundedVec<U, N>;
fn try_map<U, E>(
self,
f: impl FnMut(T) -> Result<U, E>,
) -> Result<BoundedVec<U, N>, E>;
fn try_map_ref<U, E>(
&self,
f: impl FnMut(&T) -> Result<U, E>,
) -> Result<BoundedVec<U, N>, E>;
}Expand description
Trait for vector types which have a bounded length allowing element-wise transformation.
Required Methods§
Sourcefn map<U>(self, f: impl FnMut(T) -> U) -> BoundedVec<U, N>
fn map<U>(self, f: impl FnMut(T) -> U) -> BoundedVec<U, N>
Element-wise transformation of items using the given function.
f: The transformation function.
Returns a new instance with all elements transformed using the function f.
Sourcefn map_ref<U>(&self, f: impl FnMut(&T) -> U) -> BoundedVec<U, N>
fn map_ref<U>(&self, f: impl FnMut(&T) -> U) -> BoundedVec<U, N>
Element-wise transformation of item-references using the given function.
f: The transformation function.
Returns a new instance with all element-references transformed using the function f.
Sourcefn try_map<U, E>(
self,
f: impl FnMut(T) -> Result<U, E>,
) -> Result<BoundedVec<U, N>, E>
fn try_map<U, E>( self, f: impl FnMut(T) -> Result<U, E>, ) -> Result<BoundedVec<U, N>, E>
Fallible element-wise transformation of items using the given function.
f: The transformation function.
Returns a new instance with all elements transformed using the function f, or
Err if any invocation of f resulted in error.
Sourcefn try_map_ref<U, E>(
&self,
f: impl FnMut(&T) -> Result<U, E>,
) -> Result<BoundedVec<U, N>, E>
fn try_map_ref<U, E>( &self, f: impl FnMut(&T) -> Result<U, E>, ) -> Result<BoundedVec<U, N>, E>
Fallible element-wise transformation of item-references using the given function.
f: The transformation function.
Returns a new instance with all element-references transformed using the function f, or
Err if any invocation of f resulted in error.
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.