my code is here:
let no_user = User {
id: 0,
email: "".to_owned(),
username: "".to_owned(),
password: "".to_owned(),
created_at : SystemTime::now(),
};
match login_user {
Some(login_user) => {
match verify(&signin_user.password, &login_user.password) {
Ok(valid) => {
let user_id = login_user.id.to_string();
let token = token::generate_token(user_id).unwrap();
Ok(SigninMsgs {
status: 200,
token: token,
signin_user: *login_user,
message : "Succesfully signin.".to_string(),
})
},
Err(_) => {
Ok(SigninMsgs {
status: 400,
token: "".to_owned(),
signin_user: no_user,
message : "Incorrect Password.".to_string(),
})
},
}
},
None => {
Ok(SigninMsgs {
status: 400,
token: "".to_owned(),
signin_user: no_user,
message : "Signin failure.".to_string(),
})
}
}
when 'cargo run' , I get the error:
error[E0507]: cannot move out of borrowed content
--> src/handler/func.rs:78:42
|
78 | signin_user: *login_user,
| ^^^^^^^^^^^ cannot move out of borrowed content
error: aborting due to previous error
How can i get the 'login_user' ?