Skip to main content

Encodable

Trait Encodable 

Source
pub trait Encodable {
    // Required method
    fn encode(&self) -> Vec<u8> ;

    // Provided methods
    fn encode_bytes(&self) -> Bytes { ... }
    fn content_type(&self) -> Option<Cow<'_, str>> { ... }
}
Expand description

Determines how a request is encoded.

Required Methods§

Source

fn encode(&self) -> Vec<u8>

Encode self into a byte array.

Provided Methods§

Source

fn encode_bytes(&self) -> Bytes

Encode self into Bytes.

Source

fn content_type(&self) -> Option<Cow<'_, str>>

Content type of this data.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Encodable for ()

Source§

fn encode(&self) -> Vec<u8>

Source§

impl Encodable for Bytes

Available on crate feature bytes only.

Implementors§