RcBiTransformer

Struct RcBiTransformer 

Source
pub struct RcBiTransformer<T, U, R> { /* private fields */ }
Expand description

RcBiTransformer - single-threaded bi-transformer wrapper

A single-threaded, clonable bi-transformer wrapper optimized for scenarios that require sharing without thread-safety overhead.

§Features

  • Based on: Rc<dyn Fn(T, U) -> R>
  • Ownership: Shared ownership via reference counting (non-atomic)
  • Reusability: Can be called multiple times (each call consumes its inputs)
  • Thread Safety: Not thread-safe (no Send + Sync)
  • Clonable: Cheap cloning via Rc::clone

§Author

Hu Haixing

Implementations§

Source§

impl<T, U, R> RcBiTransformer<T, U, R>
where T: 'static, U: 'static, R: 'static,

Source

pub fn new<F>(f: F) -> Self
where F: Fn(T, U) -> R + 'static,

Creates a new RcBiTransformer

§Parameters
  • f - The closure or function to wrap
§Examples
use prism3_function::{RcBiTransformer, BiTransformer};

let add = RcBiTransformer::new(|x: i32, y: i32| x + y);
assert_eq!(add.apply(20, 22), 42);
Examples found in repository?
examples/bi_transformer_demo.rs (line 42)
12fn main() {
13    println!("=== BiTransformer Demo ===\n");
14
15    // 1. BoxBiTransformer - Single ownership
16    println!("1. BoxBiTransformer - Single ownership");
17    let add = BoxBiTransformer::new(|x: i32, y: i32| x + y);
18    println!("   add.apply(20, 22) = {}", add.apply(20, 22));
19
20    let multiply = BoxBiTransformer::new(|x: i32, y: i32| x * y);
21    println!("   multiply.apply(6, 7) = {}", multiply.apply(6, 7));
22
23    // Constant bi-transformer
24    let constant = BoxBiTransformer::constant("hello");
25    println!("   constant.apply(1, 2) = {}", constant.apply(1, 2));
26    println!();
27
28    // 2. ArcBiTransformer - Thread-safe, cloneable
29    println!("2. ArcBiTransformer - Thread-safe, cloneable");
30    let arc_add = ArcBiTransformer::new(|x: i32, y: i32| x + y);
31    let arc_add_clone = arc_add.clone();
32
33    println!("   arc_add.apply(10, 15) = {}", arc_add.apply(10, 15));
34    println!(
35        "   arc_add_clone.apply(5, 8) = {}",
36        arc_add_clone.apply(5, 8)
37    );
38    println!();
39
40    // 3. RcBiTransformer - Single-threaded, cloneable
41    println!("3. RcBiTransformer - Single-threaded, cloneable");
42    let rc_multiply = RcBiTransformer::new(|x: i32, y: i32| x * y);
43    let rc_multiply_clone = rc_multiply.clone();
44
45    println!("   rc_multiply.apply(3, 4) = {}", rc_multiply.apply(3, 4));
46    println!(
47        "   rc_multiply_clone.apply(5, 6) = {}",
48        rc_multiply_clone.apply(5, 6)
49    );
50    println!();
51
52    // 4. Conditional BiTransformer
53    println!("4. Conditional BiTransformer");
54    let add_if_positive = BoxBiTransformer::new(|x: i32, y: i32| x + y);
55    let multiply_otherwise = BoxBiTransformer::new(|x: i32, y: i32| x * y);
56    let conditional = add_if_positive
57        .when(|x: &i32, y: &i32| *x > 0 && *y > 0)
58        .or_else(multiply_otherwise);
59
60    println!(
61        "   conditional.apply(5, 3) = {} (both positive, add)",
62        conditional.apply(5, 3)
63    );
64    println!(
65        "   conditional.apply(-5, 3) = {} (not both positive, multiply)",
66        conditional.apply(-5, 3)
67    );
68    println!();
69
70    // 5. Working with different types
71    println!("5. Working with different types");
72    let format =
73        BoxBiTransformer::new(|name: String, age: i32| format!("{} is {} years old", name, age));
74    println!(
75        "   format.apply(\"Alice\", 30) = {}",
76        format.apply("Alice".to_string(), 30)
77    );
78    println!();
79
80    // 6. Closure as BiTransformer
81    println!("6. Closure as BiTransformer");
82    let subtract = |x: i32, y: i32| x - y;
83    println!("   subtract.apply(42, 10) = {}", subtract.apply(42, 10));
84    println!();
85
86    // 7. Conversion between types
87    println!("7. Conversion between types");
88    let box_add = BoxBiTransformer::new(|x: i32, y: i32| x + y);
89    let rc_add = box_add.into_rc();
90    println!("   Converted BoxBiTransformer to RcBiTransformer");
91    println!("   rc_add.apply(7, 8) = {}", rc_add.apply(7, 8));
92    println!();
93
94    // 8. Safe division with Option
95    println!("8. Safe division with Option");
96    let safe_divide =
97        BoxBiTransformer::new(|x: i32, y: i32| if y == 0 { None } else { Some(x / y) });
98    println!(
99        "   safe_divide.apply(42, 2) = {:?}",
100        safe_divide.apply(42, 2)
101    );
102    println!(
103        "   safe_divide.apply(42, 0) = {:?}",
104        safe_divide.apply(42, 0)
105    );
106    println!();
107
108    // 9. String concatenation
109    println!("9. String concatenation");
110    let concat = BoxBiTransformer::new(|s1: String, s2: String| format!("{}{}", s1, s2));
111    println!(
112        "   concat.apply(\"Hello\", \"World\") = {}",
113        concat.apply("Hello".to_string(), "World".to_string())
114    );
115    println!();
116
117    println!("=== Demo Complete ===");
118}
More examples
Hide additional examples
examples/bi_transformer_and_then_demo.rs (line 63)
19fn main() {
20    println!("=== BiTransformer and_then Method Demo ===\n");
21
22    // 1. BoxBiTransformer::and_then - Basic usage
23    println!("1. BoxBiTransformer::and_then - Basic usage");
24    let add = BoxBiTransformer::new(|x: i32, y: i32| x + y);
25    let double = |x: i32| x * 2;
26    let composed = add.and_then(double);
27    println!("   (3 + 5) * 2 = {}", composed.apply(3, 5));
28    println!();
29
30    // 2. BoxBiTransformer::and_then - Chained calls
31    println!("2. BoxBiTransformer::and_then - Chained calls");
32    let multiply = BoxBiTransformer::new(|x: i32, y: i32| x * y);
33    let add_ten = |x: i32| x + 10;
34    let to_string = |x: i32| format!("Result: {}", x);
35    let pipeline = multiply.and_then(add_ten).and_then(to_string);
36    println!("   (6 * 7) + 10 = {}", pipeline.apply(6, 7));
37    println!();
38
39    // 3. ArcBiTransformer::and_then - Shared ownership
40    println!("3. ArcBiTransformer::and_then - Shared ownership");
41    let add_arc = ArcBiTransformer::new(|x: i32, y: i32| x + y);
42    let triple = |x: i32| x * 3;
43    let composed_arc = add_arc.and_then(triple);
44
45    // Original bi-transformer is still available
46    println!("   Original: 20 + 22 = {}", add_arc.apply(20, 22));
47    println!("   Composed: (5 + 3) * 3 = {}", composed_arc.apply(5, 3));
48    println!();
49
50    // 4. ArcBiTransformer::and_then - Cloneable
51    println!("4. ArcBiTransformer::and_then - Cloneable");
52    let subtract = ArcBiTransformer::new(|x: i32, y: i32| x - y);
53    let abs = |x: i32| x.abs();
54    let composed_abs = subtract.and_then(abs);
55    let cloned = composed_abs.clone();
56
57    println!("   Original: |10 - 15| = {}", composed_abs.apply(10, 15));
58    println!("   Cloned: |15 - 10| = {}", cloned.apply(15, 10));
59    println!();
60
61    // 5. RcBiTransformer::and_then - Single-threaded sharing
62    println!("5. RcBiTransformer::and_then - Single-threaded sharing");
63    let divide = RcBiTransformer::new(|x: i32, y: i32| x / y);
64    let square = |x: i32| x * x;
65    let composed_rc = divide.and_then(square);
66
67    println!("   Original: 20 / 4 = {}", divide.apply(20, 4));
68    println!("   Composed: (20 / 4)² = {}", composed_rc.apply(20, 4));
69    println!();
70
71    // 6. Type conversion example
72    println!("6. Type conversion example");
73    let concat = BoxBiTransformer::new(|s1: String, s2: String| format!("{} {}", s1, s2));
74    let to_uppercase = |s: String| s.to_uppercase();
75    let get_length = |s: String| s.len();
76
77    let uppercase_pipeline = concat.and_then(to_uppercase);
78    println!(
79        "   \"hello\" + \"world\" -> uppercase: {}",
80        uppercase_pipeline.apply("hello".to_string(), "world".to_string())
81    );
82
83    let concat2 = BoxBiTransformer::new(|s1: String, s2: String| format!("{} {}", s1, s2));
84    let length_pipeline = concat2.and_then(get_length);
85    println!(
86        "   \"hello\" + \"world\" -> length: {}",
87        length_pipeline.apply("hello".to_string(), "world".to_string())
88    );
89    println!();
90
91    // 7. Real application: Calculator
92    println!("7. Real application: Calculator");
93    let calculate = BoxBiTransformer::new(|a: f64, b: f64| a + b);
94    let round = |x: f64| x.round();
95    let to_int = |x: f64| x as i32;
96
97    let calculator = calculate.and_then(round).and_then(to_int);
98    println!(
99        "   3.7 + 4.8 -> round -> integer: {}",
100        calculator.apply(3.7, 4.8)
101    );
102    println!();
103
104    // 8. Error handling example
105    println!("8. Error handling example");
106    let safe_divide = BoxBiTransformer::new(|x: i32, y: i32| -> Result<i32, String> {
107        if y == 0 {
108            Err("Division by zero is not allowed".to_string())
109        } else {
110            Ok(x / y)
111        }
112    });
113
114    let format_result = |res: Result<i32, String>| match res {
115        Ok(v) => format!("Success: {}", v),
116        Err(e) => format!("Error: {}", e),
117    };
118
119    let safe_calculator = safe_divide.and_then(format_result);
120    println!("   10 / 2 = {}", safe_calculator.apply(10, 2));
121    println!("   10 / 0 = {}", safe_calculator.apply(10, 0));
122    println!();
123
124    // 9. Complex data structures
125    println!("9. Complex data structures");
126    #[derive(Debug)]
127    struct Point {
128        x: i32,
129        y: i32,
130    }
131
132    let create_point = BoxBiTransformer::new(|x: i32, y: i32| Point { x, y });
133    let distance_from_origin = |p: Point| ((p.x * p.x + p.y * p.y) as f64).sqrt();
134    let format_distance = |d: f64| format!("{:.2}", d);
135
136    let point_processor = create_point
137        .and_then(distance_from_origin)
138        .and_then(format_distance);
139    println!(
140        "   Distance from point(3, 4) to origin: {}",
141        point_processor.apply(3, 4)
142    );
143    println!();
144
145    // 10. Combined usage with when
146    println!("10. Combined usage with when");
147    let add_when = BoxBiTransformer::new(|x: i32, y: i32| x + y);
148    let multiply_when = BoxBiTransformer::new(|x: i32, y: i32| x * y);
149
150    let conditional = add_when
151        .when(|x: &i32, y: &i32| *x > 0 && *y > 0)
152        .or_else(multiply_when);
153
154    let double_result = |x: i32| x * 2;
155    let final_transformer = conditional.and_then(double_result);
156
157    println!(
158        "   Add positive numbers then double: (5 + 3) * 2 = {}",
159        final_transformer.apply(5, 3)
160    );
161    println!(
162        "   Multiply negative numbers then double: (-5 * 3) * 2 = {}",
163        final_transformer.apply(-5, 3)
164    );
165
166    println!("\n=== Demo completed ===");
167}
Source

pub fn and_then<S, F>(&self, after: F) -> RcBiTransformer<T, U, S>
where S: 'static, F: Transformer<R, S> + 'static,

Chain composition - applies self first, then after

Creates a new bi-transformer that applies this bi-transformer first, then applies the after transformer to the result. Uses &self, so original bi-transformer remains usable.

§Type Parameters
  • S - The output type of the after transformer
  • F - The type of the after transformer (must implement Transformer<R, S>)
§Parameters
  • after - The transformer to apply after self. Note: This parameter is passed by value and will transfer ownership. If you need to preserve the original transformer, clone it first (if it implements Clone). Can be:
    • A closure: |x: R| -> S
    • A function pointer: fn(R) -> S
    • A BoxTransformer<R, S>
    • An RcTransformer<R, S> (will be moved)
    • An ArcTransformer<R, S>
    • Any type implementing Transformer<R, S>
§Returns

A new RcBiTransformer<T, U, S> representing the composition

§Examples
§Direct value passing (ownership transfer)
use prism3_function::{BiTransformer, RcBiTransformer, RcTransformer};

let add = RcBiTransformer::new(|x: i32, y: i32| x + y);
let double = RcTransformer::new(|x: i32| x * 2);

// double is moved here
let composed = add.and_then(double);

// Original add bi-transformer still usable (uses &self)
assert_eq!(add.apply(20, 22), 42);
assert_eq!(composed.apply(3, 5), 16); // (3 + 5) * 2
// double.apply(10); // Would not compile - moved
§Preserving original with clone
use prism3_function::{BiTransformer, RcBiTransformer, RcTransformer};

let add = RcBiTransformer::new(|x: i32, y: i32| x + y);
let double = RcTransformer::new(|x: i32| x * 2);

// Clone to preserve original
let composed = add.and_then(double.clone());
assert_eq!(composed.apply(3, 5), 16); // (3 + 5) * 2

// Both originals still usable
assert_eq!(add.apply(20, 22), 42);
assert_eq!(double.apply(10), 20);
Examples found in repository?
examples/bi_transformer_and_then_demo.rs (line 65)
19fn main() {
20    println!("=== BiTransformer and_then Method Demo ===\n");
21
22    // 1. BoxBiTransformer::and_then - Basic usage
23    println!("1. BoxBiTransformer::and_then - Basic usage");
24    let add = BoxBiTransformer::new(|x: i32, y: i32| x + y);
25    let double = |x: i32| x * 2;
26    let composed = add.and_then(double);
27    println!("   (3 + 5) * 2 = {}", composed.apply(3, 5));
28    println!();
29
30    // 2. BoxBiTransformer::and_then - Chained calls
31    println!("2. BoxBiTransformer::and_then - Chained calls");
32    let multiply = BoxBiTransformer::new(|x: i32, y: i32| x * y);
33    let add_ten = |x: i32| x + 10;
34    let to_string = |x: i32| format!("Result: {}", x);
35    let pipeline = multiply.and_then(add_ten).and_then(to_string);
36    println!("   (6 * 7) + 10 = {}", pipeline.apply(6, 7));
37    println!();
38
39    // 3. ArcBiTransformer::and_then - Shared ownership
40    println!("3. ArcBiTransformer::and_then - Shared ownership");
41    let add_arc = ArcBiTransformer::new(|x: i32, y: i32| x + y);
42    let triple = |x: i32| x * 3;
43    let composed_arc = add_arc.and_then(triple);
44
45    // Original bi-transformer is still available
46    println!("   Original: 20 + 22 = {}", add_arc.apply(20, 22));
47    println!("   Composed: (5 + 3) * 3 = {}", composed_arc.apply(5, 3));
48    println!();
49
50    // 4. ArcBiTransformer::and_then - Cloneable
51    println!("4. ArcBiTransformer::and_then - Cloneable");
52    let subtract = ArcBiTransformer::new(|x: i32, y: i32| x - y);
53    let abs = |x: i32| x.abs();
54    let composed_abs = subtract.and_then(abs);
55    let cloned = composed_abs.clone();
56
57    println!("   Original: |10 - 15| = {}", composed_abs.apply(10, 15));
58    println!("   Cloned: |15 - 10| = {}", cloned.apply(15, 10));
59    println!();
60
61    // 5. RcBiTransformer::and_then - Single-threaded sharing
62    println!("5. RcBiTransformer::and_then - Single-threaded sharing");
63    let divide = RcBiTransformer::new(|x: i32, y: i32| x / y);
64    let square = |x: i32| x * x;
65    let composed_rc = divide.and_then(square);
66
67    println!("   Original: 20 / 4 = {}", divide.apply(20, 4));
68    println!("   Composed: (20 / 4)² = {}", composed_rc.apply(20, 4));
69    println!();
70
71    // 6. Type conversion example
72    println!("6. Type conversion example");
73    let concat = BoxBiTransformer::new(|s1: String, s2: String| format!("{} {}", s1, s2));
74    let to_uppercase = |s: String| s.to_uppercase();
75    let get_length = |s: String| s.len();
76
77    let uppercase_pipeline = concat.and_then(to_uppercase);
78    println!(
79        "   \"hello\" + \"world\" -> uppercase: {}",
80        uppercase_pipeline.apply("hello".to_string(), "world".to_string())
81    );
82
83    let concat2 = BoxBiTransformer::new(|s1: String, s2: String| format!("{} {}", s1, s2));
84    let length_pipeline = concat2.and_then(get_length);
85    println!(
86        "   \"hello\" + \"world\" -> length: {}",
87        length_pipeline.apply("hello".to_string(), "world".to_string())
88    );
89    println!();
90
91    // 7. Real application: Calculator
92    println!("7. Real application: Calculator");
93    let calculate = BoxBiTransformer::new(|a: f64, b: f64| a + b);
94    let round = |x: f64| x.round();
95    let to_int = |x: f64| x as i32;
96
97    let calculator = calculate.and_then(round).and_then(to_int);
98    println!(
99        "   3.7 + 4.8 -> round -> integer: {}",
100        calculator.apply(3.7, 4.8)
101    );
102    println!();
103
104    // 8. Error handling example
105    println!("8. Error handling example");
106    let safe_divide = BoxBiTransformer::new(|x: i32, y: i32| -> Result<i32, String> {
107        if y == 0 {
108            Err("Division by zero is not allowed".to_string())
109        } else {
110            Ok(x / y)
111        }
112    });
113
114    let format_result = |res: Result<i32, String>| match res {
115        Ok(v) => format!("Success: {}", v),
116        Err(e) => format!("Error: {}", e),
117    };
118
119    let safe_calculator = safe_divide.and_then(format_result);
120    println!("   10 / 2 = {}", safe_calculator.apply(10, 2));
121    println!("   10 / 0 = {}", safe_calculator.apply(10, 0));
122    println!();
123
124    // 9. Complex data structures
125    println!("9. Complex data structures");
126    #[derive(Debug)]
127    struct Point {
128        x: i32,
129        y: i32,
130    }
131
132    let create_point = BoxBiTransformer::new(|x: i32, y: i32| Point { x, y });
133    let distance_from_origin = |p: Point| ((p.x * p.x + p.y * p.y) as f64).sqrt();
134    let format_distance = |d: f64| format!("{:.2}", d);
135
136    let point_processor = create_point
137        .and_then(distance_from_origin)
138        .and_then(format_distance);
139    println!(
140        "   Distance from point(3, 4) to origin: {}",
141        point_processor.apply(3, 4)
142    );
143    println!();
144
145    // 10. Combined usage with when
146    println!("10. Combined usage with when");
147    let add_when = BoxBiTransformer::new(|x: i32, y: i32| x + y);
148    let multiply_when = BoxBiTransformer::new(|x: i32, y: i32| x * y);
149
150    let conditional = add_when
151        .when(|x: &i32, y: &i32| *x > 0 && *y > 0)
152        .or_else(multiply_when);
153
154    let double_result = |x: i32| x * 2;
155    let final_transformer = conditional.and_then(double_result);
156
157    println!(
158        "   Add positive numbers then double: (5 + 3) * 2 = {}",
159        final_transformer.apply(5, 3)
160    );
161    println!(
162        "   Multiply negative numbers then double: (-5 * 3) * 2 = {}",
163        final_transformer.apply(-5, 3)
164    );
165
166    println!("\n=== Demo completed ===");
167}
Source

pub fn when<P>(&self, predicate: P) -> RcConditionalBiTransformer<T, U, R>
where P: BiPredicate<T, U> + 'static,

Creates a conditional bi-transformer (single-threaded shared version)

Returns a bi-transformer that only executes when a bi-predicate is satisfied. You must call or_else() to provide an alternative bi-transformer.

§Parameters
  • predicate - The condition to check. Note: This parameter is passed by value and will transfer ownership. If you need to preserve the original bi-predicate, clone it first (if it implements Clone). Can be:
    • A closure: |x: &T, y: &U| -> bool
    • A function pointer: fn(&T, &U) -> bool
    • A BoxBiPredicate<T, U>
    • An RcBiPredicate<T, U>
    • An ArcBiPredicate<T, U>
    • Any type implementing BiPredicate<T, U>
§Returns

Returns RcConditionalBiTransformer<T, U, R>

§Examples
§Basic usage with or_else
use prism3_function::{BiTransformer, RcBiTransformer};

let add = RcBiTransformer::new(|x: i32, y: i32| x + y);
let multiply = RcBiTransformer::new(|x: i32, y: i32| x * y);
let conditional = add.when(|x: &i32, y: &i32| *x > 0 && *y > 0)
    .or_else(multiply);

let conditional_clone = conditional.clone();

assert_eq!(conditional.apply(5, 3), 8);
assert_eq!(conditional_clone.apply(-5, 3), -15);
§Preserving bi-predicate with clone
use prism3_function::{BiTransformer, RcBiTransformer, RcBiPredicate};

let add = RcBiTransformer::new(|x: i32, y: i32| x + y);
let both_positive = RcBiPredicate::new(|x: &i32, y: &i32|
    *x > 0 && *y > 0);

// Clone to preserve original bi-predicate
let conditional = add.when(both_positive.clone())
    .or_else(RcBiTransformer::new(|x, y| x * y));

assert_eq!(conditional.apply(5, 3), 8);

// Original bi-predicate still usable
assert!(both_positive.test(&5, &3));
Source§

impl<T, U, R> RcBiTransformer<T, U, R>
where T: 'static, U: 'static, R: Clone + 'static,

Source

pub fn constant(value: R) -> RcBiTransformer<T, U, R>

Creates a constant bi-transformer

§Examples
use prism3_function::{RcBiTransformer, BiTransformer};

let constant = RcBiTransformer::constant("hello");
assert_eq!(constant.apply(123, 456), "hello");

Trait Implementations§

Source§

impl<T, U, R> BiTransformer<T, U, R> for RcBiTransformer<T, U, R>

Source§

fn apply(&self, first: T, second: U) -> R

Transforms two input values to produce an output value Read more
Source§

fn into_box(self) -> BoxBiTransformer<T, U, R>
where T: 'static, U: 'static, R: 'static,

Converts to BoxBiTransformer Read more
Source§

fn into_rc(self) -> RcBiTransformer<T, U, R>
where T: 'static, U: 'static, R: 'static,

Converts to RcBiTransformer Read more
Source§

fn into_fn(self) -> impl Fn(T, U) -> R
where T: 'static, U: 'static, R: 'static,

Converts bi-transformer to a closure Read more
Source§

fn to_box(&self) -> BoxBiTransformer<T, U, R>
where T: 'static, U: 'static, R: 'static,

Non-consuming conversion to BoxBiTransformer using &self. Read more
Source§

fn to_rc(&self) -> RcBiTransformer<T, U, R>
where T: 'static, U: 'static, R: 'static,

Non-consuming conversion to RcBiTransformer using &self. Read more
Source§

fn to_fn(&self) -> impl Fn(T, U) -> R
where T: 'static, U: 'static, R: 'static,

Non-consuming conversion to a boxed function using &self. Read more
Source§

fn into_arc(self) -> ArcBiTransformer<T, U, R>
where Self: Sized + Send + Sync + 'static, T: Send + Sync + 'static, U: Send + Sync + 'static, R: Send + Sync + 'static,

Converts to ArcBiTransformer Read more
Source§

fn to_arc(&self) -> ArcBiTransformer<T, U, R>
where Self: Sized + Clone + Send + Sync + 'static, T: Send + Sync + 'static, U: Send + Sync + 'static, R: Send + Sync + 'static,

Non-consuming conversion to ArcBiTransformer using &self. Read more
Source§

impl<T, U, R> BiTransformerOnce<T, U, R> for RcBiTransformer<T, U, R>
where T: 'static, U: 'static, R: 'static,

Source§

fn apply_once(self, first: T, second: U) -> R

Transforms two input values, consuming self and both inputs

§Parameters
  • first - The first input value (consumed)
  • second - The second input value (consumed)
§Returns

The transformed output value

Source§

fn into_box_once(self) -> BoxBiTransformerOnce<T, U, R>
where T: 'static, U: 'static, R: 'static,

Converts to BoxBiTransformerOnce Read more
Source§

fn into_fn_once(self) -> impl FnOnce(T, U) -> R
where T: 'static, U: 'static, R: 'static,

Converts bi-transformer to a closure Read more
Source§

fn to_box_once(&self) -> BoxBiTransformerOnce<T, U, R>
where T: 'static, U: 'static, R: 'static,

Converts bi-transformer to a boxed function pointer Read more
Source§

fn to_fn_once(&self) -> impl FnOnce(T, U) -> R
where T: 'static, U: 'static, R: 'static,

Converts bi-transformer to a closure Read more
Source§

impl<T, U, R> Clone for RcBiTransformer<T, U, R>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<T, U, R> Freeze for RcBiTransformer<T, U, R>

§

impl<T, U, R> !RefUnwindSafe for RcBiTransformer<T, U, R>

§

impl<T, U, R> !Send for RcBiTransformer<T, U, R>

§

impl<T, U, R> !Sync for RcBiTransformer<T, U, R>

§

impl<T, U, R> Unpin for RcBiTransformer<T, U, R>

§

impl<T, U, R> !UnwindSafe for RcBiTransformer<T, U, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<F, T> BinaryOperator<T> for F
where F: BiTransformer<T, T, T>, T: 'static,

Source§

impl<F, T> BinaryOperatorOnce<T> for F
where F: BiTransformerOnce<T, T, T>, T: 'static,