pub struct DeviceStore { /* private fields */ }
Expand description
In-memory store holding the devices of users.
Implementations§
Source§impl DeviceStore
impl DeviceStore
Sourcepub fn add(&self, device: DeviceData) -> bool
pub fn add(&self, device: DeviceData) -> bool
Add a device to the store.
Returns true if the device was already in the store, false otherwise.
Sourcepub fn get(&self, user_id: &UserId, device_id: &DeviceId) -> Option<DeviceData>
pub fn get(&self, user_id: &UserId, device_id: &DeviceId) -> Option<DeviceData>
Get the device with the given device_id and belonging to the given user.
Sourcepub fn remove(
&self,
user_id: &UserId,
device_id: &DeviceId,
) -> Option<DeviceData>
pub fn remove( &self, user_id: &UserId, device_id: &DeviceId, ) -> Option<DeviceData>
Remove the device with the given device_id and belonging to the given user.
Returns the device if it was removed, None if it wasn’t in the store.
Sourcepub fn user_devices(
&self,
user_id: &UserId,
) -> HashMap<OwnedDeviceId, DeviceData>
pub fn user_devices( &self, user_id: &UserId, ) -> HashMap<OwnedDeviceId, DeviceData>
Get a read-only view over all devices of the given user.
Trait Implementations§
Source§impl Debug for DeviceStore
impl Debug for DeviceStore
Source§impl Default for DeviceStore
impl Default for DeviceStore
Source§fn default() -> DeviceStore
fn default() -> DeviceStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for DeviceStore
impl RefUnwindSafe for DeviceStore
impl Send for DeviceStore
impl Sync for DeviceStore
impl Unpin for DeviceStore
impl UnwindSafe for DeviceStore
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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more