mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
429 B
25 lines
429 B
struct User {
|
|
active: bool,
|
|
username: String,
|
|
email: String,
|
|
sign_in_count: u64,
|
|
}
|
|
|
|
// ANCHOR: here
|
|
fn build_user(email: String, username: String) -> User {
|
|
User {
|
|
email,
|
|
username,
|
|
active: true,
|
|
sign_in_count: 1,
|
|
}
|
|
}
|
|
// ANCHOR_END: here
|
|
|
|
fn main() {
|
|
let user1 = build_user(
|
|
String::from("someone@example.com"),
|
|
String::from("someusername123"),
|
|
);
|
|
}
|