trpl-zh-cn/listings/ch05-using-structs-to-structure-related-data/listing-05-02/src/main.rs

18 lines
331 B
Rust
Raw Normal View History

2022-02-06 16:43:51 +08:00
struct User {
active: bool,
username: String,
email: String,
sign_in_count: u64,
}
// ANCHOR: here
fn main() {
let user1 = User {
email: String::from("someone@example.com"),
username: String::from("someusername123"),
active: true,
sign_in_count: 1,
};
}
// ANCHOR_END: here