Skip to main content

Compose

Trait Compose 

Source
pub trait Compose {
    const COMPOSE_LEN: u16 = 0;

    // Required method
    fn compose<Target: OctetsBuilder + ?Sized>(
        &self,
        target: &mut Target,
    ) -> Result<(), Target::AppendError>;
}
Expand description

An extension trait to add composing to foreign types.

This trait can be used to add the compose method to a foreign type. For local types, the method should be added directly to the type instead.

The trait can only be used for types that have a fixed-size wire representation.

Provided Associated Constants§

Source

const COMPOSE_LEN: u16 = 0

The length in octets of the wire representation of a value.

Because all wire format lengths are limited to 16 bit, this is a u16 rather than a usize.

Required Methods§

Source

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Appends the wire format representation of the value to the target.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Compose for i8

Source§

const COMPOSE_LEN: u16 = 1

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl Compose for i16

Source§

const COMPOSE_LEN: u16

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl Compose for i32

Source§

const COMPOSE_LEN: u16

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl Compose for i64

Source§

const COMPOSE_LEN: u16

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl Compose for i128

Source§

const COMPOSE_LEN: u16

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl Compose for u8

Source§

const COMPOSE_LEN: u16 = 1

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl Compose for u16

Source§

const COMPOSE_LEN: u16

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl Compose for u32

Source§

const COMPOSE_LEN: u16

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl Compose for u64

Source§

const COMPOSE_LEN: u16

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl Compose for u128

Source§

const COMPOSE_LEN: u16

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Source§

impl<T: Compose + ?Sized> Compose for &T

Source§

const COMPOSE_LEN: u16 = T::COMPOSE_LEN

Source§

fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

Implementors§