[−][src]Struct serde_at::Bytes
Wrapper type to allow serializing a byte slice as bytes, rather than as a sequence (array)
Example:
use heapless::{consts, String}; use serde_at::{to_string, Bytes, SerializeOptions}; use serde_derive::Serialize; #[derive(Clone, PartialEq, Serialize)] pub struct WithBytes<'a> { s: Bytes<'a>, }; let slice = b"Some bytes"; let b = WithBytes { s: Bytes(&slice[..]), }; let s: String<consts::U32> = to_string( &b, String::<consts::U32>::from("+CMD"), SerializeOptions::default(), ) .unwrap(); assert_eq!(s, String::<consts::U32>::from("AT+CMD=Some bytes\r\n"));
Trait Implementations
impl<'a> Clone for Bytes<'a>
[src]
pub fn clone(&self) -> Bytes<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> PartialEq<Bytes<'a>> for Bytes<'a>
[src]
impl<'a> Serialize for Bytes<'a>
[src]
impl<'a> StructuralPartialEq for Bytes<'a>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,