qubit_function/functions/bi_function/rc_binary_function.rs
1/*******************************************************************************
2 *
3 * Copyright (c) 2025 - 2026.
4 * Haixing Hu, Qubit Co. Ltd.
5 *
6 * All rights reserved.
7 *
8 ******************************************************************************/
9//! Defines the `RcBinaryFunction` public type.
10
11#![allow(unused_imports)]
12
13use super::*;
14
15/// Type alias for `RcBiFunction<T, T, R>`
16///
17/// Represents a single-threaded binary function that takes two values of type `T`
18/// and produces a value of type `R`. Similar to Java's `BiFunction<T, T, R>`
19/// with shared, single-threaded ownership.
20///
21/// # Examples
22///
23/// ```rust
24/// use qubit_function::{RcBinaryFunction, BiFunction};
25///
26/// let max: RcBinaryFunction<i32, i32> = RcBinaryFunction::new(|x, y| if x > y { *x } else { *y });
27/// let max_clone = max.clone();
28/// assert_eq!(max.apply(&30, &42), 42);
29/// assert_eq!(max_clone.apply(&30, &42), 42);
30/// ```
31///
32/// # Author
33///
34/// Haixing Hu
35pub type RcBinaryFunction<T, R> = RcBiFunction<T, T, R>;