pub enum NfcUid {
Single([u8; 4]),
Double([u8; 7]),
Triple([u8; 10]),
}Expand description
Represents an NFC UID of standard lengths.
NFC UIDs come in three typical sizes:
Single: 4 bytesDouble: 7 bytesTriple: 10 bytes
This enum encapsulates these variants and ensures correct sizing during
construction via TryFrom<&[u8]> or hex parsing (FromHex, behind the
hex feature). On the wire a UID is its length as u8 followed by the
UID bytes.
§Examples
use bloop_protocol::nfc_uid::NfcUid;
let uid = NfcUid::try_from(&[0x01, 0x02, 0x03, 0x04][..])?;
assert_eq!(uid.as_bytes(), &[0x01, 0x02, 0x03, 0x04]);Variants§
Implementations§
Trait Implementations§
impl Copy for NfcUid
Source§impl<'de> Deserialize<'de> for NfcUid
Available on crate feature serde only.
impl<'de> Deserialize<'de> for NfcUid
Available on crate feature
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<NfcUid, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NfcUid, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for NfcUid
Source§impl Serialize for NfcUid
Available on crate feature serde only.
impl Serialize for NfcUid
Available on crate feature
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for NfcUid
Auto Trait Implementations§
impl Freeze for NfcUid
impl RefUnwindSafe for NfcUid
impl Send for NfcUid
impl Sync for NfcUid
impl Unpin for NfcUid
impl UnsafeUnpin for NfcUid
impl UnwindSafe for NfcUid
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Erasable for T
impl<T> Erasable for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more