11 breaking releases
0.14.0 | Jul 18, 2024 |
---|---|
0.11.0 | Jul 8, 2024 |
#8 in #gen
3KB
holder
getter setter auto gen with holder trait
example
use holder::{Holder, Holdable};
#[derive(Holder)]
struct Wrapper {
#[hold]
value: Token
}
#[derive(Holdable)]
struct Token(u32);
#[test]
fn holder_test() {
let mut wrapper = Wrapper { value: Token(123) };
let token: &Token = wrapper.token();
let token_mut: &mut Token = wrapper.token_mut();
}
fn holder_test_2<T: TokenHolder>(mut holder: T) {
*holder.token_mut() = Token(123);
}
Dependencies
~0.8–1.3MB
~25K SLoC