#[non_exhaustive]pub enum CharFormat {
Bool,
Uint8,
Uint16,
Uint32,
Uint64,
Int,
Float,
String,
Tlv8,
Data,
}Expand description
The HAP characteristic value format (the format field on a characteristic).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Bool
bool
Uint8
uint8
Uint16
uint16
Uint32
uint32
Uint64
uint64
Int
int (32-bit signed on the wire; stored as i64)
Float
float
String
string
Tlv8
tlv8 (opaque base64 on the wire; stored as raw bytes)
Data
data (opaque base64 on the wire; stored as raw bytes)
Implementations§
Source§impl CharFormat
impl CharFormat
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The wire spelling used in error messages and serialization.
Sourcepub fn value_from_json(self, v: &Value) -> Result<CharValue>
pub fn value_from_json(self, v: &Value) -> Result<CharValue>
Map a JSON value to a CharValue under this format. See the plan’s
“Format → CharValue mapping rules” table for the exact contract.
§Errors
ModelError::ValueType for a wrong JSON type, ModelError::ValueRange
for an out-of-range number, ModelError::Base64 for bad tlv8/data.
Trait Implementations§
Source§impl Clone for CharFormat
impl Clone for CharFormat
Source§fn clone(&self) -> CharFormat
fn clone(&self) -> CharFormat
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CharFormat
Source§impl Debug for CharFormat
impl Debug for CharFormat
Source§impl<'de> Deserialize<'de> for CharFormat
impl<'de> Deserialize<'de> for CharFormat
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
impl Eq for CharFormat
Source§impl PartialEq for CharFormat
impl PartialEq for CharFormat
Source§fn eq(&self, other: &CharFormat) -> bool
fn eq(&self, other: &CharFormat) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for CharFormat
impl Serialize for CharFormat
impl StructuralPartialEq for CharFormat
Auto Trait Implementations§
impl Freeze for CharFormat
impl RefUnwindSafe for CharFormat
impl Send for CharFormat
impl Sync for CharFormat
impl Unpin for CharFormat
impl UnsafeUnpin for CharFormat
impl UnwindSafe for CharFormat
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