Change UserMeta: User instead of Option<User>

I do not know why I have made it optional in the first place. hm
This commit is contained in:
bitfl0wer 2023-06-10 00:35:51 +02:00
parent dde43d9752
commit 972100af65
4 changed files with 5 additions and 8 deletions

View File

@ -63,7 +63,7 @@ pub mod login {
login_result.token, login_result.token,
cloned_limits, cloned_limits,
login_result.settings, login_result.settings,
Some(object), object,
); );
Ok(user) Ok(user)

View File

@ -71,7 +71,7 @@ pub mod register {
token.clone(), token.clone(),
cloned_limits, cloned_limits,
settings, settings,
Some(user_object), user_object,
); );
Ok(user) Ok(user)
} }

View File

@ -72,10 +72,7 @@ impl UserMeta {
Err(e) => return Err(e), Err(e) => return Err(e),
}; };
let user_updated: User = from_str(&result.text().await.unwrap()).unwrap(); let user_updated: User = from_str(&result.text().await.unwrap()).unwrap();
let _ = std::mem::replace( let _ = std::mem::replace(&mut self.object, user_updated.clone());
&mut self.object.as_mut().unwrap(),
&mut user_updated.clone(),
);
Ok(user_updated) Ok(user_updated)
} }

View File

@ -90,7 +90,7 @@ pub struct UserMeta {
pub token: String, pub token: String,
pub limits: Limits, pub limits: Limits,
pub settings: UserSettings, pub settings: UserSettings,
pub object: Option<User>, pub object: User,
} }
impl UserMeta { impl UserMeta {
@ -107,7 +107,7 @@ impl UserMeta {
token: String, token: String,
limits: Limits, limits: Limits,
settings: UserSettings, settings: UserSettings,
object: Option<User>, object: User,
) -> UserMeta { ) -> UserMeta {
UserMeta { UserMeta {
belongs_to, belongs_to,