Enum PayloadFormat
pub enum PayloadFormat {
Json,
Cbor,
}Expand description
Supported payload formats for MQTT messages.
This type represents the payload format segment used in the command topics.
Variants§
Implementations§
§impl PayloadFormat
impl PayloadFormat
pub fn serialize<T>(self, value: &T) -> Result<Vec<u8>>where
T: Serialize,
pub fn serialize<T>(self, value: &T) -> Result<Vec<u8>>where
T: Serialize,
Serializes the given value according to the payload format.
pub fn deserialize<T>(self, payload: &[u8]) -> Result<T>where
T: DeserializeOwned,
pub fn deserialize<T>(self, payload: &[u8]) -> Result<T>where
T: DeserializeOwned,
Deserializes data from the given payload according to the payload format.
Trait Implementations§
§impl Clone for PayloadFormat
impl Clone for PayloadFormat
§fn clone(&self) -> PayloadFormat
fn clone(&self) -> PayloadFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for PayloadFormat
impl Debug for PayloadFormat
§impl Display for PayloadFormat
impl Display for PayloadFormat
§impl FromStr for PayloadFormat
impl FromStr for PayloadFormat
§impl PartialEq for PayloadFormat
impl PartialEq for PayloadFormat
impl Copy for PayloadFormat
impl Eq for PayloadFormat
impl StructuralPartialEq for PayloadFormat
Auto Trait Implementations§
impl Freeze for PayloadFormat
impl RefUnwindSafe for PayloadFormat
impl Send for PayloadFormat
impl Sync for PayloadFormat
impl Unpin for PayloadFormat
impl UnwindSafe for PayloadFormat
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