pub trait TupleMap10 {
type Item;
Show 24 methods
// Required methods
fn all<F>(self, f: F) -> bool
where F: FnMut(Self::Item) -> bool;
fn any<F>(self, f: F) -> bool
where F: FnMut(Self::Item) -> bool;
fn by_ref(
&self,
) -> (&Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item);
fn by_ref_mut(
&mut self,
) -> (&mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item);
fn find<F>(self, f: F) -> Option<Self::Item>
where F: FnMut(&Self::Item) -> bool;
fn fold<B, F>(self, init: B, f: F) -> B
where F: FnMut(B, Self::Item) -> B;
fn for_each<F>(self, f: F)
where F: FnMut(Self::Item);
fn id(
self,
) -> (Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item);
fn into_vec(self) -> Vec<Self::Item>;
fn map<B, F>(self, f: F) -> (B, B, B, B, B, B, B, B, B, B)
where F: FnMut(Self::Item) -> B;
fn nth(self, i: usize) -> Option<Self::Item>;
fn same(self) -> bool
where Self::Item: PartialEq;
fn same_as(self, i: Self::Item) -> bool
where Self::Item: PartialEq;
fn sum(self) -> Self::Item
where Self::Item: AddAssign;
fn product(self) -> Self::Item
where Self::Item: MulAssign;
fn tmax(self) -> Self::Item
where Self::Item: PartialOrd;
fn tmin(self) -> Self::Item
where Self::Item: PartialOrd;
fn zip<U, B>(
self,
other: U,
) -> ((Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B))
where U: TupleMap10<Item = B>;
fn zipf<U, I, F, B>(self, other: U, f: F) -> (B, B, B, B, B, B, B, B, B, B)
where U: TupleMap10<Item = I>,
F: FnMut(Self::Item, I) -> B;
// Provided methods
fn cloned(
&self,
) -> (Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item)
where Self::Item: Clone { ... }
fn add<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
where U: TupleMap10<Item = I>,
Self::Item: Add<I, Output = B>,
Self: Sized { ... }
fn sub<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
where U: TupleMap10<Item = I>,
Self::Item: Sub<I, Output = B>,
Self: Sized { ... }
fn mul<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
where U: TupleMap10<Item = I>,
Self::Item: Mul<I, Output = B>,
Self: Sized { ... }
fn div<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
where U: TupleMap10<Item = I>,
Self::Item: Div<I, Output = B>,
Self: Sized { ... }
}
Required Associated Types§
Required Methods§
Sourcefn all<F>(self, f: F) -> bool
fn all<F>(self, f: F) -> bool
Checks if every element of tuple matches a predicate, like
std::iter::Iterator::all
.
This method take a closure returns true
or false
, and tries to apply this
closure to all elements of tuple. If and only if all of them returns true
,
this method return true
.
§Examples
let a = (3, 9, 12, ...);
assert!(a.all(|x| x % 3 == 0));
assert!(!a.all(|x| x % 4 == 0));
Sourcefn any<F>(self, f: F) -> bool
fn any<F>(self, f: F) -> bool
Checks if any element of tuple matches a predicate, like
std::iter::Iterator::any
.
This method take a closure returns true
or false
, and tries to apply this
closure to all elements of tuple. If any of them returns true
,
this method return true
.
§Examples
let a = (3, 9, 12, ...);
assert!(a.any(|x| x % 4 == 0));
assert!(!a.any(|x| x % 7 == 0));
Sourcefn by_ref(
&self,
) -> (&Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item)
fn by_ref( &self, ) -> (&Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item, &Self::Item)
Sourcefn by_ref_mut(
&mut self,
) -> (&mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item)
fn by_ref_mut( &mut self, ) -> (&mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item, &mut Self::Item)
Sourcefn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
Takes a closure f
and applies it to all elements to tuple, and produce single value.
This is similar to std::iter::Iterator::fold
§Example
let a = (3, 4, 5, ...)
let sum = a.fold(0, |sum, x| sum + x);
Sourcefn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
Takes a closure f
and applies it to all elements to tuple.
f
can cause side effect(because it’s FnMut
), but this method return nothing.
Similar to std::iter::Iterator::for_each
§Example
let a = (3, 4, 5, ...);
let mut sum = 0;
a.for_each(|x| sum += x);
Sourcefn id(
self,
) -> (Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item)
fn id( self, ) -> (Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item)
return Self. It’s not intended to used by user.
Sourcefn map<B, F>(self, f: F) -> (B, B, B, B, B, B, B, B, B, B)
fn map<B, F>(self, f: F) -> (B, B, B, B, B, B, B, B, B, B)
Takes a closure f
and (a, a, a, …), then returns (f(a), f(a), f(a), …).
Similar to std::iter::Iterator::map
.
§Example
let a = (3, 4, 5, ...);
assert_eq!(a.map(|x| x * 2), (6, 8, 10, ...));
Sourcefn tmax(self) -> Self::Itemwhere
Self::Item: PartialOrd,
fn tmax(self) -> Self::Itemwhere
Self::Item: PartialOrd,
Takes (a, b, c, ...)
then returns the maximum value of tuple.
This method is named tmax
instead of max
, to avoid overlap
to std::cmp::ord::max
.
Sourcefn tmin(self) -> Self::Itemwhere
Self::Item: PartialOrd,
fn tmin(self) -> Self::Itemwhere
Self::Item: PartialOrd,
Takes (a, b, c, ...)
then returns the minimum value of tuple.
This method is named tmin
instead of min
, to avoid overlap
to std::cmp::ord::min
.
Sourcefn zip<U, B>(
self,
other: U,
) -> ((Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B))where
U: TupleMap10<Item = B>,
fn zip<U, B>(
self,
other: U,
) -> ((Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B), (Self::Item, B))where
U: TupleMap10<Item = B>,
Sourcefn zipf<U, I, F, B>(self, other: U, f: F) -> (B, B, B, B, B, B, B, B, B, B)
fn zipf<U, I, F, B>(self, other: U, f: F) -> (B, B, B, B, B, B, B, B, B, B)
Provided Methods§
Sourcefn cloned(
&self,
) -> (Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item)
fn cloned( &self, ) -> (Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item, Self::Item)
Sourcefn add<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
fn add<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
Sourcefn sub<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
fn sub<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
Sourcefn mul<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
fn mul<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
Sourcefn div<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
fn div<U, I, B>(self, other: U) -> (B, B, B, B, B, B, B, B, B, B)
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.