qubit_function/functions/bi_function/arc_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 `ArcBinaryFunction` public type.
12
13use super::ArcBiFunction;
14
15/// Type alias for `ArcBiFunction<T, T, R>`
16///
17/// Represents a thread-safe 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, thread-safe ownership.
20///
21/// # Examples
22///
23/// ```rust
24/// use qubit_function::{ArcBinaryFunction, BiFunction};
25///
26/// let multiply: ArcBinaryFunction<i32, i32> = ArcBinaryFunction::new(|x, y| *x * *y);
27/// let multiply_clone = multiply.clone();
28/// assert_eq!(multiply.apply(&6, &7), 42);
29/// assert_eq!(multiply_clone.apply(&6, &7), 42);
30/// ```
31///
32pub type ArcBinaryFunction<T, R> = ArcBiFunction<T, T, R>;