Skip to main content

type_flow_traits/
lib.rs

1pub trait ShiftLeft {
2    type ShiftedLeft;
3    fn shift_left(self) -> Self::ShiftedLeft;
4}
5
6pub trait ShiftRight {
7    type ShiftedRight;
8    fn shift_right(self) -> Self::ShiftedRight;
9}
10
11pub trait SwapStartEnd {
12    type Output;
13    fn swap(self) -> Self::Output;
14}
15
16pub trait Reverse {
17    type Output;
18    fn reverse(self) -> Self::Output;
19}
20
21pub trait StatefulProcessor<T> {
22    fn process(&mut self, data: T) -> T;
23}
24pub trait InPlaceStatefulProcessor<T, E> {
25    fn process(&mut self, data: &mut T) -> Result<(), E>;
26}
27pub trait InplaceStatefulTransformer<I, O, E> {
28    fn process(&mut self, previous_data: I, data: &mut O) -> Result<(), E>;
29}
30pub trait Processor<T> {
31    fn process(data: T) -> T;
32}
33pub trait InPlaceProcessor<T, E> {
34    fn process(data: &mut T)->Result<(), E>;
35}
36
37pub trait StatefulTransformProcessor<I, O> {
38    fn process(&self, data: I) -> O;
39}
40
41pub trait TransformProcessor<I, O> {
42    fn process(data: I) -> O;
43}
44
45pub trait SwapArbitraryProcessors<const I: usize, const J: usize> where Self: Sized {
46    type SwappedOutput;
47    fn swap_processors(self) -> Self::SwappedOutput;
48}
49
50pub trait PivotSpin<const I: usize> where Self: Sized {
51    type PivotedSpinOutput;
52    fn pivot_spin(self) -> Self::PivotedSpinOutput;
53}
54
55pub trait PivotSwap<const I: usize> where Self: Sized {
56    type PivotedSwapOutput;
57    fn pivot_swap(self) -> Self::PivotedSwapOutput;
58}
59
60pub trait InterleavePivotSpin<const I: usize> where Self: Sized {
61    type InterleavePivotSpinOutput;
62    fn interleaved_pivot_spin(self) -> Self::InterleavePivotSpinOutput;
63}
64
65pub trait InterleavePivotSwap<const I: usize> where Self: Sized {
66    type InterleavePivotSwapOutput;
67    fn interleaved_pivot_swap(self) -> Self::InterleavePivotSwapOutput;
68}