pub trait ConSubseqMapReplace<Seq, F, I>: ConSubseq<Seq, I>where
Seq: TupleLike,{
type MapReplaceOutput: TupleLike;
// Required method
fn map_replace_con_subseq(self, f: F) -> Self::MapReplaceOutput;
}
Expand description
Replace elements of a specific contiguous subsequence to another sequence that may be of different element types.
Required Associated Types§
Sourcetype MapReplaceOutput: TupleLike
type MapReplaceOutput: TupleLike
The type of tuple that replace elements of a specific contiguous subsequence to another sequence that may be of different element types.
Required Methods§
Sourcefn map_replace_con_subseq(self, f: F) -> Self::MapReplaceOutput
fn map_replace_con_subseq(self, f: F) -> Self::MapReplaceOutput
Replace elements of specific contiguous subsequence with another sequence that may be of different element types.
The elements of new sequence is generated from the user-defined mapper.
Check out Mapper
’s documentation page to learn how to build a mapper.
Hint: The TupleLike
trait provides the map_replace_con_subseq()
method as the wrapper for this map_replace_con_subseq()
method.
§Example
use tuplez::{mapper, tuple, TupleLike, tuple_t};
let tup = tuple!("1", "2", "3", true, false, true);
let result = tup.map_replace_con_subseq::<tuple_t!(&str, bool, bool), _, _>(mapper! {
|x: &str| -> i32 { x.parse().unwrap() }
|x: bool| -> bool { !x }
});
assert_eq!(result, tuple!("1", "2", 3, false, true, true));
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.