Skip to main content

Serialize

Trait Serialize 

Source
pub trait Serialize {
    // Required method
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
       where S: Serializer;
}
Expand description

Types that can be serialized via #[serde(with = "serde_bytes")].

Required Methods§

Source

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Serialize for Vec<u8>

Available on crate features alloc or std only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Source§

impl Serialize for [u8]

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Source§

impl<'a> Serialize for Cow<'a, Bytes>

Available on crate features alloc or std only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Source§

impl<'a> Serialize for Cow<'a, [u8]>

Available on crate features alloc or std only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Source§

impl<T> Serialize for &T
where T: ?Sized + Serialize,

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Source§

impl<T> Serialize for Box<T>
where T: ?Sized + Serialize,

Available on crate features alloc or std only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Source§

impl<T> Serialize for Option<T>
where T: Serialize,

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Source§

impl<const N: usize> Serialize for [u8; N]

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Implementors§

Source§

impl Serialize for ByteBuf

Available on crate features alloc or std only.
Source§

impl Serialize for Bytes

Source§

impl<const N: usize> Serialize for ByteArray<N>