Skip to main content

Encode

Trait Encode 

Source
pub trait Encode {
    const ALIGNMENT: Alignment;

    // Required method
    fn encode(&self, raw: &mut Raw<'_>);
}
Expand description

A Rust value which can be written to a D-Bus message body.

This is implemented for the owned types that generated code uses, and for their borrowed counterparts so that a client does not have to allocate in order to make a call.

§Examples

use tokio_dbus::Signature;
use tokio_dbus_runtime::Arguments;

let mut arguments = Arguments::new(Signature::new("sas")?)?;
arguments.store("Hello");
arguments.store(&["a", "b"][..]);

Required Associated Constants§

Source

const ALIGNMENT: Alignment

The alignment of the encoded value, which the containers this value is nested inside need in order to pad correctly.

Required Methods§

Source

fn encode(&self, raw: &mut Raw<'_>)

Write the value, without writing its signature.

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 Encode for ObjectPath

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for ObjectPathBuf

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for Signature

Source§

const ALIGNMENT: Alignment = Alignment::BYTE

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for SignatureBuf

Source§

const ALIGNMENT: Alignment = Alignment::BYTE

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for String

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for bool

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for f64

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for i16

Source§

const ALIGNMENT: Alignment = Alignment::U16

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for i32

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for i64

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for str

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for u8

Source§

const ALIGNMENT: Alignment = Alignment::BYTE

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for u16

Source§

const ALIGNMENT: Alignment = Alignment::U16

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for u32

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl Encode for u64

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> Encode for (A, B, C, D, E, F, G, H, I, J, K, L)
where A: Encode, B: Encode, C: Encode, D: Encode, E: Encode, F: Encode, G: Encode, H: Encode, I: Encode, J: Encode, K: Encode, L: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C, D, E, F, G, H, I, J, K> Encode for (A, B, C, D, E, F, G, H, I, J, K)
where A: Encode, B: Encode, C: Encode, D: Encode, E: Encode, F: Encode, G: Encode, H: Encode, I: Encode, J: Encode, K: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C, D, E, F, G, H, I, J> Encode for (A, B, C, D, E, F, G, H, I, J)
where A: Encode, B: Encode, C: Encode, D: Encode, E: Encode, F: Encode, G: Encode, H: Encode, I: Encode, J: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C, D, E, F, G, H, I> Encode for (A, B, C, D, E, F, G, H, I)
where A: Encode, B: Encode, C: Encode, D: Encode, E: Encode, F: Encode, G: Encode, H: Encode, I: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C, D, E, F, G, H> Encode for (A, B, C, D, E, F, G, H)
where A: Encode, B: Encode, C: Encode, D: Encode, E: Encode, F: Encode, G: Encode, H: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C, D, E, F, G> Encode for (A, B, C, D, E, F, G)
where A: Encode, B: Encode, C: Encode, D: Encode, E: Encode, F: Encode, G: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C, D, E, F> Encode for (A, B, C, D, E, F)
where A: Encode, B: Encode, C: Encode, D: Encode, E: Encode, F: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C, D, E> Encode for (A, B, C, D, E)
where A: Encode, B: Encode, C: Encode, D: Encode, E: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C, D> Encode for (A, B, C, D)
where A: Encode, B: Encode, C: Encode, D: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B, C> Encode for (A, B, C)
where A: Encode, B: Encode, C: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A, B> Encode for (A, B)
where A: Encode, B: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<A> Encode for (A,)
where A: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U64

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<K, V, S> Encode for HashMap<K, V, S>
where K: Encode, V: Encode, S: BuildHasher,

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<K, V> Encode for BTreeMap<K, V>
where K: Encode, V: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<T, const N: usize> Encode for [T; N]
where T: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

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

Source§

const ALIGNMENT: Alignment = T::ALIGNMENT

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<T> Encode for Vec<T>
where T: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Source§

impl<T> Encode for [T]
where T: Encode,

Source§

const ALIGNMENT: Alignment = Alignment::U32

Source§

fn encode(&self, raw: &mut Raw<'_>)

Implementors§

Source§

impl Encode for Value

Source§

const ALIGNMENT: Alignment = Alignment::BYTE