zyc_getset

Crates.iozyc_getset
lib.rszyc_getset
version0.0.1
sourcesrc
created_at2024-12-05 10:43:47.633702
updated_at2024-12-05 11:16:28.370862
descriptionFor personal projects using this crate, it is recommended to stick with the original getset crate. As an extension to the original crate, we've introduced a new method: get_clone. Methods without an explicit visibility specifier are automatically declared as pub. This is a conscious design choice, as internal methods typically don't necessitate getset mechanisms.
homepage
repositoryhttps://github.com/jbaublitz/getset
max_upload_size
id1473069
size50,902
(jerrybaxia)

documentation

README

zyc_getset

For personal projects using this crate, it is recommended to stick with the original getset 0.1.3(https://crates.io/crates/getset) crate.

As an extension to the original crate, we've introduced a new method: get_clone.

Methods without an explicit visibility specifier are automatically declared as pub. This is a conscious design choice, as internal methods typically don't necessitate getset mechanisms.

#[derive(Getters, CloneGetters)]
pub struct Foo {
    #[get]
    id: i32,
    #[get_clone]
    name: String,
}
use zyc_getset::Getters;
pub struct Foo {
    #[get]
    id: i32,
    #[get_clone]
    name: String,
}
impl Foo {
    #[inline(always)]
    pub fn id(&self) -> &i32 {
        &self.id
    }
}
impl Foo {
    #[inline(always)]
    pub fn name(&self) -> String {  // default pub
        self.name.clone()   // add clone
    }
}
Commit count: 164

cargo fmt