pub struct DeviceInfo {
pub device_id: String,
pub platform: DevicePlatform,
pub model: Option<String>,
pub app_version: Option<String>,
pub system_version: Option<String>,
pub metadata: HashMap<String, String>,
}Expand description
设备信息
Fields§
§device_id: String设备唯一标识符(由客户端生成)
platform: DevicePlatform设备平台类型
model: Option<String>设备型号(可选,如 “iPhone 14”, “Samsung Galaxy S23”)
app_version: Option<String>应用版本(可选)
system_version: Option<String>系统版本(可选)
metadata: HashMap<String, String>其他自定义元数据
Implementations§
Source§impl DeviceInfo
impl DeviceInfo
Sourcepub fn new(device_id: String, platform: DevicePlatform) -> Self
pub fn new(device_id: String, platform: DevicePlatform) -> Self
创建新的设备信息
Sourcepub fn with_model(self, model: String) -> Self
pub fn with_model(self, model: String) -> Self
设置设备型号
Sourcepub fn with_app_version(self, version: String) -> Self
pub fn with_app_version(self, version: String) -> Self
设置应用版本
Sourcepub fn with_system_version(self, version: String) -> Self
pub fn with_system_version(self, version: String) -> Self
设置系统版本
Sourcepub fn with_metadata(self, key: String, value: String) -> Self
pub fn with_metadata(self, key: String, value: String) -> Self
添加元数据
Trait Implementations§
Source§impl Clone for DeviceInfo
impl Clone for DeviceInfo
Source§fn clone(&self) -> DeviceInfo
fn clone(&self) -> DeviceInfo
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 DeviceInfo
impl Debug for DeviceInfo
Source§impl<'de> Deserialize<'de> for DeviceInfo
impl<'de> Deserialize<'de> for DeviceInfo
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
Auto Trait Implementations§
impl Freeze for DeviceInfo
impl RefUnwindSafe for DeviceInfo
impl Send for DeviceInfo
impl Sync for DeviceInfo
impl Unpin for DeviceInfo
impl UnsafeUnpin for DeviceInfo
impl UnwindSafe for DeviceInfo
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