Crates.io | derive-combine |
lib.rs | derive-combine |
version | 0.1.0 |
source | src |
created_at | 2023-05-04 21:58:03.084386 |
updated_at | 2023-05-04 21:58:03.084386 |
description | A macro for combining multiple structs into one |
homepage | |
repository | https://github.com/andrewgazelka/derive-combine |
max_upload_size | |
id | 857130 |
size | 4,768 |
use derive_combine::Combine;
#[derive(Combine, Eq, PartialEq, Debug)]
struct Abc {
a: Option<u8>,
b: Vec<u8>,
d: u16,
}
#[test]
fn test_combine() {
let mut abc = Abc {
a: Some(1),
b: vec![2],
d: 3,
};
let other = Abc {
a: None,
b: vec![4],
d: 5,
};
abc.combine(other);
let expected = Abc {
a: Some(1),
b: vec![2, 4],
d: 3,
};
assert_eq!(abc, expected);
}