partial_derive2

Crates.iopartial_derive2
lib.rspartial_derive2
version0.4.3
sourcesrc
created_at2023-06-11 08:00:10.485772
updated_at2024-06-08 07:24:47.275765
descriptionmakes all the properties of a struct type an optional property
homepage
repositoryhttps://github.com/mbecker20/partial_derive2
max_upload_size
id887287
size4,766
(MoghTech)

documentation

https://docs.rs/partial_derive2

README

partial_derive

Like Partial<T> of TypeScript, makes all the properties of a struct type an optional property.

Provides Partial derive macro.

#[derive(Partial, Clone)]
#[partial_derive(Clone)]
struct SomeStruct {
    pub field_one: i32,
    field_two: Vec<bool>,
}

generates

#[derive(Clone)]
struct PartialSomeStruct {
    pub field_one: Option<i32>,
    field_two: Option<Vec<bool>>,
}
Commit count: 30

cargo fmt