1pub mod client;
7pub mod connection;
8pub mod listener;
9pub mod protocol;
10
11pub use client::MuxClient;
12pub use listener::MuxEvent;
13
14use crate::mux::protocol::DeviceEntryRaw;
15
16#[derive(Debug, Clone)]
18pub struct MuxDevice {
19 pub device_id: u32,
20 pub serial_number: String, pub connection_type: String,
22 pub product_id: u16,
23}
24
25impl MuxDevice {
26 pub(crate) fn from_raw(raw: DeviceEntryRaw) -> Self {
27 Self {
28 device_id: raw.device_id,
29 serial_number: raw.properties.serial_number,
30 connection_type: raw.properties.connection_type,
31 product_id: raw.properties.product_id.unwrap_or(0),
32 }
33 }
34}
35
36#[derive(Debug, thiserror::Error)]
38pub enum MuxError {
39 #[error("IO error: {0}")]
40 Io(#[from] std::io::Error),
41 #[error("protocol error: {0}")]
42 Protocol(String),
43 #[error("device not found: {0}")]
44 DeviceNotFound(String),
45}