File: struct-leaf-attributes.rs

package info (click to toggle)
rust-daft-derive 0.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 404 kB
  • sloc: makefile: 2
file content (19 lines) | stat: -rw-r--r-- 372 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use daft::Diffable;

#[derive(Diffable)]
#[daft(leaf)]
struct MyStruct {
    // Attributes on leaf-struct fields are banned.
    #[daft(ignore)]
    a: i32,
    #[daft(leaf)]
    b: i32,
}

fn main() {
    // MyStruct and its Diffable should exist.
    let before = MyStruct { a: 0, b: 0 };
    let after = MyStruct { a: 0, b: 1 };

    let _diff = before.diff(&after);
}