pavex/blueprint/constructor/
cloning_strategy.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
/// Determines whether Pavex is allowed to clone a component—e.g. the output type returned by a constructor
/// or a state input.
pub enum CloningStrategy {
    /// Pavex will **never** try clone the type.  
    /// Pavex will return an error if cloning is necessary to generate code
    /// that satisfies Rust's borrow checker.
    NeverClone,
    /// Pavex will only clone the type if it's
    /// necessary to generate code that satisfies Rust's borrow checker.
    CloneIfNecessary,
}