Skip to main content

qubit_function/functions/mutating_function/
fn_mutating_function_ops.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 `FnMutatingFunctionOps` public type.
12
13use super::{
14    BoxConditionalMutatingFunction,
15    BoxMutatingFunction,
16    Function,
17    Predicate,
18    impl_fn_ops_trait,
19};
20
21// =======================================================================
22// 7. Provide extension methods for closures
23// =======================================================================
24
25// Generates: FnFunctionOps trait and blanket implementation
26impl_fn_ops_trait!(
27    (Fn(&mut T) -> R),
28    FnMutatingFunctionOps,
29    BoxMutatingFunction,
30    Function, // chains a non-mutating function after this mutating function
31    BoxConditionalMutatingFunction
32);