pub trait Enumerable: TupleLike {
type EnumerateOutput: TupleLike;
// Required method
fn enumerate(self, from: usize) -> Self::EnumerateOutput;
}
Expand description
Convert from tuple!(x, y, z, ...)
to tuple!((0, x), (1, y), (2, z), ...)
.
Required Associated Types§
Sourcetype EnumerateOutput: TupleLike
type EnumerateOutput: TupleLike
The type of the output tuple.
Required Methods§
Sourcefn enumerate(self, from: usize) -> Self::EnumerateOutput
fn enumerate(self, from: usize) -> Self::EnumerateOutput
Convert from tuple!(x, y, z, ...)
to tuple!((0, x), (1, y), (2, z), ...)
.
Hint: The TupleLike
trait provides the enumerate()
method as the wrapper
for this enumerate()
method.
§Example
use tuplez::{tuple, TupleLike};
let tup = tuple!("hello", Some([1, 2, 3]), tuple!(3.14, 12));
assert_eq!(tup.enumerate(), tuple!(
(0, "hello"),
(1, Some([1, 2, 3])),
(2, tuple!(3.14, 12)),
));
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.