pub struct ProfileManager { /* private fields */ }Expand description
Manages up to 8 local user profiles.
Implementations§
Source§impl ProfileManager
impl ProfileManager
pub const MAX_PROFILES: usize = 8
pub fn new() -> Self
Sourcepub fn create(
&mut self,
display_name: impl Into<String>,
timestamp: u64,
) -> Result<u64, String>
pub fn create( &mut self, display_name: impl Into<String>, timestamp: u64, ) -> Result<u64, String>
Create a new profile with the given display name.
Sourcepub fn current(&self) -> Option<&UserProfile>
pub fn current(&self) -> Option<&UserProfile>
Get the currently active profile.
Sourcepub fn current_mut(&mut self) -> Option<&mut UserProfile>
pub fn current_mut(&mut self) -> Option<&mut UserProfile>
Get a mutable reference to the currently active profile.
pub fn list(&self) -> Vec<&UserProfile>
pub fn get_by_id(&self, id: u64) -> Option<&UserProfile>
pub fn get_by_id_mut(&mut self, id: u64) -> Option<&mut UserProfile>
pub fn count(&self) -> usize
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, String>
pub fn from_bytes(data: &[u8]) -> Result<Self, String>
Deserialise from bytes produced by to_bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProfileManager
impl RefUnwindSafe for ProfileManager
impl Send for ProfileManager
impl Sync for ProfileManager
impl Unpin for ProfileManager
impl UnsafeUnpin for ProfileManager
impl UnwindSafe for ProfileManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.