1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*******************************************************************************
*
* Copyright (c) 2025 - 2026.
* Haixing Hu, Qubit Co. Ltd.
*
* All rights reserved.
*
******************************************************************************/
//! Defines the `BoxBinaryMutatingFunction` public type.
use *;
// ============================================================================
// Type Aliases for BinaryMutatingOperator (BiMutatingFunction<T, U, R> where T == U)
// ============================================================================
/// Type alias for `BoxBiMutatingFunction<T, T, R>`
///
/// Represents a binary mutating function that takes two values of type `T` and produces
/// a value of type `R`, with single ownership semantics. Similar to Java's
/// `BiFunction<T, T, R>` but with mutable references.
///
/// # Examples
///
/// ```rust
/// use qubit_function::{BoxBinaryMutatingFunction, BiMutatingFunction};
///
/// let swap_and_sum: BoxBinaryMutatingFunction<i32, i32> = BoxBinaryMutatingFunction::new(|x, y| {
/// let temp = *x;
/// *x = *y;
/// *y = temp;
/// *x + *y
/// });
/// let mut a = 5;
/// let mut b = 10;
/// assert_eq!(swap_and_sum.apply(&mut a, &mut b), 15);
/// assert_eq!(a, 10);
/// assert_eq!(b, 5);
/// ```
///
/// # Author
///
/// Haixing Hu
pub type BoxBinaryMutatingFunction<T, R> = ;