Trait Write

Source
pub trait Write: Sealed { }
Expand description

A type who’s reference can be written directly to a buffer.

These types are written using methods such as BodyBuf::store.

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 Write for str

Write a length-prefixed string to the buffer.

§Examples

use tokio_dbus::{BodyBuf, Signature};

let mut buf = BodyBuf::new();
buf.store("foo");

assert_eq!(buf.signature(), Signature::STRING);
assert_eq!(buf.get(), &[3, 0, 0, 0, 102, 111, 111, 0])
Source§

impl Write for [u8]

Write a byte array to the buffer.

§Examples

use tokio_dbus::BodyBuf;

let mut buf = BodyBuf::new();
buf.store(&b"foo"[..]);

assert_eq!(buf.signature(), "ay");
assert_eq!(buf.get(), &[3, 0, 0, 0, 102, 111, 111]);

Implementors§