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