#properties #partial-derive #struct #optional #macro-derive

macro partial_derive2_derive

makes all the properties of a struct type an optional property

13 releases

0.4.5 Dec 30, 2025
0.4.3 Jun 8, 2024
0.4.2 May 10, 2024
0.3.2 Apr 28, 2024
0.1.9 Jul 11, 2023

#51 in #optional

Download history 76/week @ 2025-10-09 81/week @ 2025-10-16 103/week @ 2025-10-23 52/week @ 2025-10-30 73/week @ 2025-11-06 79/week @ 2025-11-13 50/week @ 2025-11-20 82/week @ 2025-11-27 55/week @ 2025-12-04 57/week @ 2025-12-11 32/week @ 2025-12-18 49/week @ 2025-12-25 38/week @ 2026-01-01 95/week @ 2026-01-08 23/week @ 2026-01-15 82/week @ 2026-01-22

238 downloads per month
Used in 5 crates (via partial_derive2)

MIT license

13KB
348 lines

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>>,
}

Dependencies

~140–530KB
~13K SLoC