partial_derive

Crates.iopartial_derive
lib.rspartial_derive
version0.1.0
sourcesrc
created_at2022-03-21 09:35:53.229519
updated_at2022-03-21 09:35:53.229519
descriptionmakes all the properties of a struct type an optional property
homepage
repositoryhttps://github.com/rise0chen/partial_derive
max_upload_size
id553988
size4,825
Rise Chen (rise0chen)

documentation

https://docs.rs/partial_derive

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)]
#[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: 1

cargo fmt