mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Add lots of derived Debug impls
This commit is contained in:
parent
e580250d5d
commit
05391e27cd
23 changed files with 125 additions and 124 deletions
|
@ -14,7 +14,7 @@ pub mod scanfilter;
|
|||
use ipc_channel::ipc::IpcSender;
|
||||
use scanfilter::{BluetoothScanfilterSequence, RequestDeviceoptions};
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum BluetoothError {
|
||||
Type(String),
|
||||
Network,
|
||||
|
@ -24,7 +24,7 @@ pub enum BluetoothError {
|
|||
InvalidState,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum GATTType {
|
||||
PrimaryService,
|
||||
Characteristic,
|
||||
|
@ -32,21 +32,21 @@ pub enum GATTType {
|
|||
Descriptor,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct BluetoothDeviceMsg {
|
||||
// Bluetooth Device properties
|
||||
pub id: String,
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct BluetoothServiceMsg {
|
||||
pub uuid: String,
|
||||
pub is_primary: bool,
|
||||
pub instance_id: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct BluetoothCharacteristicMsg {
|
||||
// Characteristic
|
||||
pub uuid: String,
|
||||
|
@ -63,7 +63,7 @@ pub struct BluetoothCharacteristicMsg {
|
|||
pub writable_auxiliaries: bool,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct BluetoothDescriptorMsg {
|
||||
pub uuid: String,
|
||||
pub instance_id: String,
|
||||
|
@ -79,7 +79,7 @@ pub type BluetoothResult<T> = Result<T, BluetoothError>;
|
|||
|
||||
pub type BluetoothResponseResult = Result<BluetoothResponse, BluetoothError>;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum BluetoothRequest {
|
||||
RequestDevice(RequestDeviceoptions, IpcSender<BluetoothResponseResult>),
|
||||
GATTServerConnect(String, IpcSender<BluetoothResponseResult>),
|
||||
|
@ -107,7 +107,7 @@ pub enum BluetoothRequest {
|
|||
Exit,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum BluetoothResponse {
|
||||
RequestDevice(BluetoothDeviceMsg),
|
||||
GATTServerConnect(bool),
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::slice::Iter;
|
|||
// That leaves 29 bytes for the name.
|
||||
const MAX_NAME_LENGTH: usize = 29;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ServiceUUIDSequence(Vec<String>);
|
||||
|
||||
impl ServiceUUIDSequence {
|
||||
|
@ -26,7 +26,7 @@ impl ServiceUUIDSequence {
|
|||
type ManufacturerData = HashMap<u16, (Vec<u8>, Vec<u8>)>;
|
||||
type ServiceData = HashMap<String, (Vec<u8>, Vec<u8>)>;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct BluetoothScanfilter {
|
||||
name: Option<String>,
|
||||
name_prefix: String,
|
||||
|
@ -83,7 +83,7 @@ impl BluetoothScanfilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct BluetoothScanfilterSequence(Vec<BluetoothScanfilter>);
|
||||
|
||||
impl BluetoothScanfilterSequence {
|
||||
|
@ -110,7 +110,7 @@ impl BluetoothScanfilterSequence {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct RequestDeviceoptions {
|
||||
filters: BluetoothScanfilterSequence,
|
||||
optional_services: ServiceUUIDSequence,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue