pub enum DeviceConflictStrategy {
AllowAll,
MobileExclusive,
PlatformExclusive,
FullyExclusive,
MobileAndPcCoexist,
Custom {
allowed_combinations: Vec<HashSet<DevicePlatform>>,
exclusive_groups: Vec<HashSet<DevicePlatform>>,
},
}Expand description
设备冲突处理策略
Variants§
AllowAll
允许所有设备同时在线(不检查冲突)
MobileExclusive
移动端互斥(同一用户只能有一个移动端设备在线) 例如:Android 和 iOS 互斥,但 PC 和移动端可以同时在线
PlatformExclusive
平台互斥(同一平台只能有一个设备在线) 例如:同一用户的 Android 设备之间互斥,但 Android 和 iOS 可以同时在线
FullyExclusive
完全互斥(同一用户只能有一个设备在线)
MobileAndPcCoexist
移动端和PC端共存(移动端之间互斥,PC端之间互斥,但移动端和PC端可以同时在线) 例如:同一用户可以有 1 个移动端 + 1 个 PC 同时在线
Custom
自定义规则(指定哪些平台可以同时在线)
Fields
§
allowed_combinations: Vec<HashSet<DevicePlatform>>允许同时在线 platform 组合列表 例如:[{Web, PC}] 表示 Web 和 PC 可以同时在线
§
exclusive_groups: Vec<HashSet<DevicePlatform>>互斥的平台组(组内互斥) 例如:[{Android, IOS, HarmonyOS}] 表示移动端互斥
Implementations§
Source§impl DeviceConflictStrategy
impl DeviceConflictStrategy
Sourcepub fn check_conflict(
&self,
new_device: DevicePlatform,
existing_devices: &HashSet<DevicePlatform>,
) -> Result<(), Vec<DevicePlatform>>
pub fn check_conflict( &self, new_device: DevicePlatform, existing_devices: &HashSet<DevicePlatform>, ) -> Result<(), Vec<DevicePlatform>>
Trait Implementations§
Source§impl Clone for DeviceConflictStrategy
impl Clone for DeviceConflictStrategy
Source§fn clone(&self) -> DeviceConflictStrategy
fn clone(&self) -> DeviceConflictStrategy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DeviceConflictStrategy
impl Debug for DeviceConflictStrategy
Source§impl Default for DeviceConflictStrategy
impl Default for DeviceConflictStrategy
Source§fn default() -> DeviceConflictStrategy
fn default() -> DeviceConflictStrategy
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DeviceConflictStrategy
impl<'de> Deserialize<'de> for DeviceConflictStrategy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DeviceConflictStrategy
Source§impl PartialEq for DeviceConflictStrategy
impl PartialEq for DeviceConflictStrategy
Source§fn eq(&self, other: &DeviceConflictStrategy) -> bool
fn eq(&self, other: &DeviceConflictStrategy) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DeviceConflictStrategy
impl Serialize for DeviceConflictStrategy
impl StructuralPartialEq for DeviceConflictStrategy
Auto Trait Implementations§
impl Freeze for DeviceConflictStrategy
impl RefUnwindSafe for DeviceConflictStrategy
impl Send for DeviceConflictStrategy
impl Sync for DeviceConflictStrategy
impl Unpin for DeviceConflictStrategy
impl UnsafeUnpin for DeviceConflictStrategy
impl UnwindSafe for DeviceConflictStrategy
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