pub struct DeviceManager { /* private fields */ }Expand description
设备管理器
管理用户设备的在线状态,根据冲突策略处理设备登录
Implementations§
Source§impl DeviceManager
impl DeviceManager
Sourcepub fn new(conflict_strategy: DeviceConflictStrategy) -> Self
pub fn new(conflict_strategy: DeviceConflictStrategy) -> Self
创建新的设备管理器
Sourcepub async fn add_device(
&self,
user_id: &str,
connection_id: String,
device_info: DeviceInfo,
) -> Result<Vec<String>>
pub async fn add_device( &self, user_id: &str, connection_id: String, device_info: DeviceInfo, ) -> Result<Vec<String>>
Sourcepub async fn get_user_devices(&self, user_id: &str) -> Vec<DeviceInfo>
pub async fn get_user_devices(&self, user_id: &str) -> Vec<DeviceInfo>
获取用户的所有设备
Sourcepub async fn get_user_connections(&self, user_id: &str) -> Vec<String>
pub async fn get_user_connections(&self, user_id: &str) -> Vec<String>
获取用户的所有连接 ID
Sourcepub async fn get_device_connection(
&self,
user_id: &str,
device_id: &str,
) -> Option<String>
pub async fn get_device_connection( &self, user_id: &str, device_id: &str, ) -> Option<String>
获取设备的连接 ID
Sourcepub fn update_strategy(&mut self, strategy: DeviceConflictStrategy)
pub fn update_strategy(&mut self, strategy: DeviceConflictStrategy)
更新冲突策略
Auto Trait Implementations§
impl !RefUnwindSafe for DeviceManager
impl !UnwindSafe for DeviceManager
impl Freeze for DeviceManager
impl Send for DeviceManager
impl Sync for DeviceManager
impl Unpin for DeviceManager
impl UnsafeUnpin for DeviceManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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