3 releases
0.1.2 | Dec 5, 2024 |
---|---|
0.1.1 | Dec 5, 2024 |
0.1.0 | Dec 4, 2024 |
0.0.0 |
|
#960 in Rust patterns
345 downloads per month
Used in yukon_derive
10KB
126 lines
yukon
Provides trait for the ability to cheaply duplicate an object.
lib.rs
:
Provides trait for the ability to cheaply duplicate an object.
Examples
Claim
can be derived for structs that contain only fields that implement Claim
themselves:
use yukon::Claim;
#[derive(Claim)]
struct Context {
value: Arc<usize>,
}
#
Alternatively, Claim
can be implemented manually:
#
#
impl Claim for Context {
fn claim(&self) -> Self {
Self {
value: Arc::clone(&self.value),
}
}
}
#
References
This crate has been inspired by Claiming, auto and otherwise.
Dependencies
~105KB