From 5ceff05581964a3ba677a0dfde07e314646bb6bd Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 27 Aug 2020 21:49:05 +0200 Subject: Format Signed-off-by: Matthias Beyer --- src/client.rs | 10 +++---- src/enums.rs | 95 +++++++++++++++++++++++++++++------------------------------ 2 files changed, 51 insertions(+), 54 deletions(-) diff --git a/src/client.rs b/src/client.rs index 7d48676..ddf4145 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,5 +1,3 @@ - - use futures::future::poll_fn; use futures::task::Poll; use tokio::net::TcpStream; @@ -16,10 +14,10 @@ type EventClosure = dyn FnMut(&Event) + Sync + Send + 'static; type EventClosureMutex = Box; pub fn event_handler(f: F) -> EventClosureMutex - where F: FnMut(&Event) + Sync + Send + 'static - { - Box::new(f) - } +where F: FnMut(&Event) + Sync + Send + 'static +{ + Box::new(f) +} pub struct FlicClient { reader: Mutex, diff --git a/src/enums.rs b/src/enums.rs index 83fe016..b99ea1f 100644 --- a/src/enums.rs +++ b/src/enums.rs @@ -1,4 +1,3 @@ - #![allow(dead_code)] use num_enum::TryFromPrimitive; @@ -9,91 +8,91 @@ use num_enum::IntoPrimitive; #[repr(u8)] #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, IntoPrimitive, TryFromPrimitive)] pub enum CreateConnectionChannelError { - NoError, - MaxPendingConnectionsReached, + NoError, + MaxPendingConnectionsReached, } #[repr(u8)] #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, IntoPrimitive, TryFromPrimitive)] pub enum ConnectionStatus { - Disconnected, - Connected, - Ready, + Disconnected, + Connected, + Ready, } #[repr(u8)] #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, IntoPrimitive, TryFromPrimitive)] pub enum DisconnectReason { - Unspecified, - ConnectionEstablishmentFailed, - TimedOut, - BondingKeysMismatch, + Unspecified, + ConnectionEstablishmentFailed, + TimedOut, + BondingKeysMismatch, } #[repr(u8)] #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, IntoPrimitive, TryFromPrimitive)] pub enum RemovedReason { - RemovedByThisClient, - ForceDisconnectedByThisClient, - ForceDisconnectedByOtherClient, - - ButtonIsPrivate, - VerifyTimeout, - InternetBackendError, - InvalidData, - - CouldntLoadDevice, - - DeletedByThisClient, - DeletedByOtherClient, - ButtonBelongsToOtherPartner, - DeletedFromButton, + RemovedByThisClient, + ForceDisconnectedByThisClient, + ForceDisconnectedByOtherClient, + + ButtonIsPrivate, + VerifyTimeout, + InternetBackendError, + InvalidData, + + CouldntLoadDevice, + + DeletedByThisClient, + DeletedByOtherClient, + ButtonBelongsToOtherPartner, + DeletedFromButton, } #[repr(u8)] #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, IntoPrimitive, TryFromPrimitive)] pub enum ClickType { - ButtonDown, - ButtonUp, - ButtonClick, - ButtonSingleClick, - ButtonDoubleClick, - ButtonHold, + ButtonDown, + ButtonUp, + ButtonClick, + ButtonSingleClick, + ButtonDoubleClick, + ButtonHold, } #[repr(u8)] #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, IntoPrimitive, TryFromPrimitive)] pub enum BdAddrType { - PublicBdAddrType, - RandomBdAddrType, + PublicBdAddrType, + RandomBdAddrType, } #[repr(u8)] #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, IntoPrimitive, TryFromPrimitive)] pub enum LatencyMode { - NormalLatency, - LowLatency, - HighLatency, + NormalLatency, + LowLatency, + HighLatency, } #[repr(u8)] #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, IntoPrimitive, TryFromPrimitive)] pub enum ScanWizardResult { - WizardSuccess, - WizardCancelledByUser, - WizardFailedTimeout, - WizardButtonIsPrivate, - WizardBluetoothUnavailable, - WizardInternetBackendError, - WizardInvalidData, - WizardButtonBelongsToOtherPartner, - WizardButtonAlreadyConnectedToOtherDevice, + WizardSuccess, + WizardCancelledByUser, + WizardFailedTimeout, + WizardButtonIsPrivate, + WizardBluetoothUnavailable, + WizardInternetBackendError, + WizardInvalidData, + WizardButtonBelongsToOtherPartner, + WizardButtonAlreadyConnectedToOtherDevice, } #[repr(u8)] #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, IntoPrimitive, TryFromPrimitive)] pub enum BluetoothControllerState { - Detached, - Resetting, - Attached, + Detached, + Resetting, + Attached, } -- cgit v1.2.3