pub struct DeviceTokenStore { /* private fields */ }Expand description
In-memory device token store
Thread-safe store for device tokens, keyed by user ID. Each user can have multiple tokens (multiple devices).
Implementations§
Source§impl DeviceTokenStore
impl DeviceTokenStore
Sourcepub async fn register(&self, user_id: &str, token: String, platform: Platform)
pub async fn register(&self, user_id: &str, token: String, platform: Platform)
Register a device token for a user
If the same token already exists for this user, it is updated (platform and registered_at are refreshed).
Sourcepub async fn unregister(&self, user_id: &str, token: &str) -> bool
pub async fn unregister(&self, user_id: &str, token: &str) -> bool
Unregister a device token for a user
Returns true if the token was found and removed.
Sourcepub async fn get_tokens(&self, user_id: &str) -> Vec<DeviceToken>
pub async fn get_tokens(&self, user_id: &str) -> Vec<DeviceToken>
Get all device tokens for a user
Sourcepub async fn token_count(&self, user_id: &str) -> usize
pub async fn token_count(&self, user_id: &str) -> usize
Get token count for a user
Sourcepub async fn remove_all(&self, user_id: &str) -> usize
pub async fn remove_all(&self, user_id: &str) -> usize
Remove all tokens for a user (e.g., on account deletion)
Trait Implementations§
Source§impl Debug for DeviceTokenStore
impl Debug for DeviceTokenStore
Auto Trait Implementations§
impl !Freeze for DeviceTokenStore
impl !RefUnwindSafe for DeviceTokenStore
impl Send for DeviceTokenStore
impl Sync for DeviceTokenStore
impl Unpin for DeviceTokenStore
impl UnsafeUnpin for DeviceTokenStore
impl !UnwindSafe for DeviceTokenStore
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