This commit is contained in:
2025-03-26 12:41:58 -04:00
parent 637b26a0e9
commit 416dd617e6
36 changed files with 732 additions and 0 deletions

1
example_10/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/target

12
example_10/Cargo.toml Normal file
View File

@@ -0,0 +1,12 @@
[package]
name = "example_10"
version = "0.1.0"
edition = "2021"
[dependencies]
serde = { version = "1", features = ["derive"] }
[features]
default = ["test"]
test = []

28
example_10/src/main.rs Normal file
View File

@@ -0,0 +1,28 @@
use serde::Deserialize;
use serde::Serialize;
macro_rules! assert_eq {
($left:expr, $right:expr) => {
let left = $left;
let right = $right;
if left != right {
panic!("assertion failed: {:?} != {:?}", left, right);
}
};
}
#[derive(Serialize, Deserialize)]
struct Person {
name: String,
age: u32,
}
fn main() {
assert_eq!(1 + 1, 2);
if cfg!(feature = "test") {
println!("yes")
} else {
println!("no")
}
}