t_wの輪郭

Feedlyでフォローするボタン
Ruststructmut可変変数
struct User {
    username: String,
    email: String,
    sign_in_count: u64,
    active: bool,
}

fn main() {
    let mut user1 = User {
        username: String::from("username1"),
        email: String::from("user@example.com"),
        active: true,
        sign_in_count: 1,
    };

    user1.username = String::from("username2");

    println!("{}", user1.username);    //username2
}
あれ