clone_behavior/speed.rs
1mod sealed {
2 #[expect(unnameable_types, reason = "This is intentional, and creates a sealed trait")]
3 pub trait Sealed {}
4}
5
6
7use self::sealed::Sealed;
8
9
10/// Indicates that a cloning operation is constant-time.
11///
12/// This might be nearly instant, or involve briefly acquiring a lock and performing a few
13/// computations.
14pub enum Fast {}
15/// Places no constraints on the speed of a cloning operation.
16pub enum MaybeSlow {}
17
18
19impl Sealed for Fast {}
20impl Sealed for MaybeSlow {}
21
22
23/// Trait for indicating the overhead and/or time complexity of a cloning operation.
24pub trait Speed: Sealed {}
25
26impl Speed for Fast {}
27impl Speed for MaybeSlow {}
28
29
30/// Trait for indicating the overhead and/or time complexity of a cloning operation.
31pub trait FastSpeed: Sealed {}
32
33impl FastSpeed for Fast {}