partial_derive 0.1.0

makes all the properties of a struct type an optional property
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use partial_derive::Partial;

#[test]
fn test() {
    #[rustfmt::skip::attributes(derive)]
    #[allow(dead_code)]
    #[derive(Partial)]
    #[derive(Debug, Clone, PartialEq)]
    struct Struct {
        field: i32,
    }
    let o = Struct {
        field: 3,
    };
    let partial = PartialStruct::from(o);
    assert_eq!(partial.field, Some(3));
}