pub struct StoreArray<'a, T>where
T: Aligned,{ /* private fields */ }Expand description
Write a typed array.
See BodyBuf::store_array.
Implementations§
Source§impl<'a, T> StoreArray<'a, T>where
T: Aligned,
impl<'a, T> StoreArray<'a, T>where
T: Aligned,
Sourcepub fn finish(self)
pub fn finish(self)
Finish writing the array.
This will also be done implicitly once this is dropped.
See BodyBuf::store_array.
Source§impl<T> StoreArray<'_, T>where
T: Aligned,
impl<T> StoreArray<'_, T>where
T: Aligned,
Sourcepub fn store(&mut self, value: T::Return<'_>)
pub fn store(&mut self, value: T::Return<'_>)
Store a value and return the builder for the next value to store.
See BodyBuf::store_array.
Sourcepub fn store_struct(&mut self) -> StoreStruct<'_, T>where
T: Fields,
pub fn store_struct(&mut self) -> StoreStruct<'_, T>where
T: Fields,
Write a struct inside of the array.
See BodyBuf::store_array.
Source§impl StoreArray<'_, Variant>
impl StoreArray<'_, Variant>
Sourcepub fn store_variant(&mut self, signature: &Signature) -> StoreVariant<'_>
pub fn store_variant(&mut self, signature: &Signature) -> StoreVariant<'_>
Write a variant inside of the array.
§Examples
use tokio_dbus::{ty, BodyBuf, Signature, Variant};
let mut buf = BodyBuf::new();
let mut array = buf.store_array::<ty::Variant>()?;
array.store_variant(Signature::STRING).store("Hello World!");
array.store_variant(Signature::UINT32).store(42u32);
array.finish();
assert_eq!(buf.signature(), "av");
let mut buf = buf.as_body();
let mut array = buf.load_array::<ty::Variant>()?;
assert_eq!(array.load_variant()?, Some(Variant::String("Hello World!")));
assert_eq!(array.load_variant()?, Some(Variant::U32(42)));
assert_eq!(array.load_variant()?, None);Source§impl<K, V> StoreArray<'_, Dict<K, V>>
impl<K, V> StoreArray<'_, Dict<K, V>>
Sourcepub fn store_entry(&mut self) -> StoreStruct<'_, (K, V)>
pub fn store_entry(&mut self) -> StoreStruct<'_, (K, V)>
Write a dict entry inside of the array.
§Examples
use tokio_dbus::{ty, BodyBuf, Signature, Variant};
let mut buf = BodyBuf::new();
let mut dict = buf.store_array::<ty::Dict<ty::Str, ty::Variant>>()?;
dict.store_entry().store("Id").store(Variant::String("example")).finish();
dict.store_entry().store("ItemIsMenu").store(Variant::Bool(false)).finish();
dict.finish();
assert_eq!(buf.signature(), "a{sv}");
let mut buf = buf.as_body();
let mut dict = buf.load_array::<ty::Dict<ty::Str, ty::Variant>>()?;
assert_eq!(dict.load_entry()?, Some(("Id", Variant::String("example"))));
assert_eq!(dict.load_entry()?, Some(("ItemIsMenu", Variant::Bool(false))));
assert_eq!(dict.load_entry()?, None);Source§impl<T> StoreArray<'_, Array<T>>where
T: Aligned,
impl<T> StoreArray<'_, Array<T>>where
T: Aligned,
Sourcepub fn store_array(&mut self) -> StoreArray<'_, T>
pub fn store_array(&mut self) -> StoreArray<'_, T>
Write an array inside of the array.
See BodyBuf::store_array.
Source§impl StoreArray<'_, u8>
impl StoreArray<'_, u8>
Sourcepub fn write_slice(&mut self, bytes: &[u8])
pub fn write_slice(&mut self, bytes: &[u8])
Extend a byte array with the given slice.
See BodyBuf::store_array.
Trait Implementations§
Source§impl<T> Drop for StoreArray<'_, T>where
T: Aligned,
impl<T> Drop for StoreArray<'_, T>where
T: Aligned,
Auto Trait Implementations§
impl<'a, T> !UnwindSafe for StoreArray<'a, T>
impl<'a, T> Freeze for StoreArray<'a, T>
impl<'a, T> RefUnwindSafe for StoreArray<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for StoreArray<'a, T>where
T: Send,
impl<'a, T> Sync for StoreArray<'a, T>where
T: Sync,
impl<'a, T> Unpin for StoreArray<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for StoreArray<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more