Skip to main content

qubit_function/functions/bi_function/
box_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 `BoxBinaryFunction` public type.
10
11#![allow(unused_imports)]
12
13use super::*;
14
15// ============================================================================
16// Type Aliases for BinaryOperator (BiFunction<T, T, R>)
17// ============================================================================
18
19/// Type alias for `BoxBiFunction<T, T, R>`
20///
21/// Represents a binary function that takes two values of type `T` and produces
22/// a value of type `R`, with single ownership semantics. Similar to Java's
23/// `BiFunction<T, T, R>` but with different type parameters.
24///
25/// # Examples
26///
27/// ```rust
28/// use qubit_function::{BoxBinaryFunction, BiFunction};
29///
30/// let add: BoxBinaryFunction<i32, i32> = BoxBinaryFunction::new(|x, y| *x + *y);
31/// assert_eq!(add.apply(&20, &22), 42);
32/// ```
33///
34/// # Author
35///
36/// Haixing Hu
37pub type BoxBinaryFunction<T, R> = BoxBiFunction<T, T, R>;