Init
This commit is contained in:
commit
bf08cdc5dc
6 changed files with 187 additions and 0 deletions
31
examples/example.rs
Normal file
31
examples/example.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
use none_guard::NoneGuard;
|
||||
|
||||
#[derive(NoneGuard)]
|
||||
struct Test {
|
||||
x: Option<i32>,
|
||||
y: Option<String>,
|
||||
z: Option<f32>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = Test {
|
||||
x: Some(1),
|
||||
y: None,
|
||||
z: None,
|
||||
};
|
||||
dbg!(x.is_all_none());
|
||||
|
||||
let y = Test {
|
||||
x: None,
|
||||
y: Some("dd".to_string()),
|
||||
z: Some(2.0),
|
||||
};
|
||||
dbg!(y.is_all_none());
|
||||
|
||||
let z = Test {
|
||||
x: None,
|
||||
y: None,
|
||||
z: None,
|
||||
};
|
||||
dbg!(z.is_all_none());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue