pub struct Device {
pub id: String,
pub name: String,
pub info: DeviceInfo,
pub endpoints: HashMap<String, String>,
pub discovered_at: Instant,
pub last_seen: Instant,
}Expand description
A discovered Clasp device
Fields§
§id: StringUnique device identifier
name: StringHuman-readable name
info: DeviceInfoDevice info
endpoints: HashMap<String, String>Endpoints (transport -> address)
discovered_at: InstantWhen the device was discovered
last_seen: InstantLast seen time
Implementations§
Source§impl Device
impl Device
Sourcepub fn with_ws_endpoint(self, url: &str) -> Self
pub fn with_ws_endpoint(self, url: &str) -> Self
Add a WebSocket endpoint
Sourcepub fn with_udp_endpoint(self, addr: SocketAddr) -> Self
pub fn with_udp_endpoint(self, addr: SocketAddr) -> Self
Add a UDP endpoint
Sourcepub fn udp_addr(&self) -> Option<SocketAddr>
pub fn udp_addr(&self) -> Option<SocketAddr>
Get the UDP address
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Device
impl<'de> Deserialize<'de> for Device
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 Device
impl RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl UnsafeUnpin for Device
impl UnwindSafe for Device
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