client-api: Make device::Device non-exhaustive

This commit is contained in:
Jonas Platte 2021-01-29 15:32:07 +01:00
parent dd5b2db4d5
commit d14213ab3e
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -13,6 +13,7 @@ pub mod update_device;
/// Information about a registered device.
#[derive(Clone, Debug, Deserialize, Hash, PartialEq, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct Device {
/// Device ID
pub device_id: DeviceIdBox,
@ -31,3 +32,10 @@ pub struct Device {
)]
pub last_seen_ts: Option<SystemTime>,
}
impl Device {
/// Creates a new `Device` with the given device ID.
pub fn new(device_id: DeviceIdBox) -> Self {
Self { device_id, display_name: None, last_seen_ip: None, last_seen_ts: None }
}
}