ConSubseqMapReplace

Trait ConSubseqMapReplace 

Source
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§

Source

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§

Source

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.

Implementors§

Source§

impl<F> ConSubseqMapReplace<Unit, F, Complete> for Unit

Source§

impl<First1, First2, Other1, Other2, F, I> ConSubseqMapReplace<Tuple<First1, Tuple<First2, Other2>>, F, Used<I>> for Tuple<First1, Other1>
where Other1: ConSubseqMapReplace<Tuple<First2, Other2>, <F as Mapper<First1>>::NextMapper, Used<I>>, Other2: TupleLike, F: Mapper<First1>,

Source§

type MapReplaceOutput = Tuple<<F as Mapper<First1>>::Output, <Other1 as ConSubseqMapReplace<Tuple<First2, Other2>, <F as Mapper<First1>>::NextMapper, Used<I>>>::MapReplaceOutput>

Source§

impl<First, Other, F, I> ConSubseqMapReplace<Tuple<First, Unit>, F, Used<I>> for Tuple<First, Other>
where Other: ConSubseqMapReplace<Unit, <F as Mapper<First>>::NextMapper, I>, F: Mapper<First>,

Source§

type MapReplaceOutput = Tuple<<F as Mapper<First>>::Output, Other>

Source§

impl<First, Other, T, F, I> ConSubseqMapReplace<T, F, Unused<I>> for Tuple<First, Other>
where T: TupleLike, Other: ConSubseqMapReplace<T, F, I>,