RcUnaryOperator

Type Alias RcUnaryOperator 

Source
pub type RcUnaryOperator<T> = RcTransformer<T, T>;
Expand description

Type alias for RcTransformer<T, T>

Represents a single-threaded unary operator that transforms a value of type T to another value of the same type T. Equivalent to Java’s UnaryOperator<T> with shared, single-threaded ownership.

§Examples

use prism3_function::{RcUnaryOperator, Transformer};

let negate: RcUnaryOperator<i32> = RcUnaryOperator::new(|x: i32| -x);
let negate_clone = negate.clone();
assert_eq!(negate.apply(42), -42);
assert_eq!(negate_clone.apply(42), -42);

§Author

Hu Haixing

Aliased Type§

pub struct RcUnaryOperator<T> { /* private fields */ }