Struct matrix_sdk_crypto::store::caches::DeviceStore
source · [−]pub struct DeviceStore { /* private fields */ }Expand description
In-memory store holding the devices of users.
Implementations
sourceimpl DeviceStore
impl DeviceStore
sourcepub fn add(&self, device: ReadOnlyDevice) -> bool
pub fn add(&self, device: ReadOnlyDevice) -> 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<ReadOnlyDevice>
pub fn get(
&self,
user_id: &UserId,
device_id: &DeviceId
) -> Option<ReadOnlyDevice>
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<ReadOnlyDevice>
pub fn remove(
&self,
user_id: &UserId,
device_id: &DeviceId
) -> Option<ReadOnlyDevice>
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, ReadOnlyDevice>
pub fn user_devices(
&self,
user_id: &UserId
) -> HashMap<OwnedDeviceId, ReadOnlyDevice>
Get a read-only view over all devices of the given user.
Trait Implementations
sourceimpl Clone for DeviceStore
impl Clone for DeviceStore
sourcefn clone(&self) -> DeviceStore
fn clone(&self) -> DeviceStore
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for DeviceStore
impl Debug for DeviceStore
sourceimpl Default for DeviceStore
impl Default for DeviceStore
sourcefn default() -> DeviceStore
fn default() -> DeviceStore
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for DeviceStore
impl Send for DeviceStore
impl Sync for DeviceStore
impl Unpin for DeviceStore
impl !UnwindSafe for DeviceStore
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more