pub struct UserState {
pub owner: Principal,
pub wallet_canister: Principal,
/* private fields */
}Expand description
Represents the state of the canister, including users, and wallet canister.
Fields§
§owner: Principal§wallet_canister: PrincipalImplementations§
source§impl UserState
impl UserState
sourcepub fn init(&mut self, wallet_canister: Principal)
pub fn init(&mut self, wallet_canister: Principal)
Initializes the state with the wallet canister. This function should only be called once, when the canister is first installed.
sourcepub fn get_user_mut(
&mut self,
user: &Principal
) -> Result<&mut UserData, UserStateError>
pub fn get_user_mut( &mut self, user: &Principal ) -> Result<&mut UserData, UserStateError>
This function returns a mutable reference to the user data. Retrieves user data for a given user Principal.
Trait Implementations§
source§impl CandidType for UserState
impl CandidType for UserState
source§impl<'de> Deserialize<'de> for UserState
impl<'de> Deserialize<'de> for UserState
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more