struct JsonStylePhydat(Phydat);
saul
only.Expand description
An extended phydat that almost behaves like phydat_to_json but with CBOR
It produces a map containing a “u” entry with the text form of the unit, and a “d” entry with either a single numeric of a vector of 2 or 3 numeric entries. Numeric entries are integers or decimal fractions (thus easily expressing the phydat’s scale value without actually calculating)
It can be serialized using serde, minicbor or ciborium_ll. (ciborium would use serde, but is not an option here as it uses alloc).
Tuple Fields§
§0: Phydat
Implementations§
Trait Implementations§
Source§impl<'a, C> Decode<'a, C> for JsonStylePhydat
impl<'a, C> Decode<'a, C> for JsonStylePhydat
Source§fn decode(d: &mut Decoder<'_>, _ctx: &mut C) -> Result<Self, Error>
fn decode(d: &mut Decoder<'_>, _ctx: &mut C) -> Result<Self, Error>
Decode a JsonStylePhydat item from CBOR
This decoder is generally strict, it currently accepts one oddity: It lets unrecognized units slip silently; consequently it also doesn’t complain if the unit is given multiple times if it’s nonsensical.
Source§impl<C> Encode<C> for JsonStylePhydat
impl<C> Encode<C> for JsonStylePhydat
Auto Trait Implementations§
impl Freeze for JsonStylePhydat
impl RefUnwindSafe for JsonStylePhydat
impl Send for JsonStylePhydat
impl Sync for JsonStylePhydat
impl Unpin for JsonStylePhydat
impl UnwindSafe for JsonStylePhydat
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
Source§impl<T> IntoSwitch for T
impl<T> IntoSwitch for T
Source§fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
Source§fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 10 bytes