pub struct Signature(/* private fields */);Expand description
A D-Bus signature.
§Examples
use tokio_dbus::Signature;
const SIG: &Signature = Signature::new_const(b"aaaai");
assert!(Signature::new(b"aai").is_ok());Implementations§
Source§impl Signature
impl Signature
Sourcepub const EMPTY: &'static Signature
pub const EMPTY: &'static Signature
The empty signature.
§Examples
use tokio_dbus::{BodyBuf, Signature};
let body = BodyBuf::new();
assert_eq!(body.signature(), Signature::EMPTY);Sourcepub const OBJECT_PATH: &'static Signature
pub const OBJECT_PATH: &'static Signature
The signature of an object path.
§Examples
use tokio_dbus::{BodyBuf, Signature, ObjectPath};
let mut body = BodyBuf::new();
body.store(ObjectPath::new(b"/org/freedesktop/DBus")?);
assert_eq!(body.signature(), Signature::OBJECT_PATH);Sourcepub const STRING: &'static Signature
pub const STRING: &'static Signature
The signature of a nul-terminated string.
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store("Hello World!");
assert_eq!(body.signature(), Signature::STRING);Sourcepub const VARIANT: &'static Signature
pub const VARIANT: &'static Signature
The signature of a variant value.
§Examples
use tokio_dbus::{BodyBuf, Signature, Variant};
let mut body = BodyBuf::new();
body.store(Variant::U32(10u32));
assert_eq!(body.signature(), Signature::VARIANT);Sourcepub const BOOLEAN: &'static Signature
pub const BOOLEAN: &'static Signature
A boolean value, marshalled as a 32-bit integer which is either 0 or
1.
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store(true);
assert_eq!(body.signature(), Signature::BOOLEAN);Sourcepub const BYTE: &'static Signature
pub const BYTE: &'static Signature
A single byte.
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store(10u8);
assert_eq!(body.signature(), Signature::BYTE);Sourcepub const INT16: &'static Signature
pub const INT16: &'static Signature
Signed (two’s complement) 16-bit integer.
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store(10i16);
assert_eq!(body.signature(), Signature::INT16);Sourcepub const UINT16: &'static Signature
pub const UINT16: &'static Signature
Unsigned 16-bit integer.
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store(10u16);
assert_eq!(body.signature(), Signature::UINT16);Sourcepub const INT32: &'static Signature
pub const INT32: &'static Signature
Signed (two’s complement) 32-bit integer
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store(10i32);
assert_eq!(body.signature(), Signature::INT32);Sourcepub const UINT32: &'static Signature
pub const UINT32: &'static Signature
Unsigned 32-bit integer
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store(10u32);
assert_eq!(body.signature(), Signature::UINT32);Sourcepub const INT64: &'static Signature
pub const INT64: &'static Signature
Signed (two’s complement) 64-bit integer (mnemonic: x and t are the first characters in “sixty” not already used for something more common)
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store(10i64);
assert_eq!(body.signature(), Signature::INT64);Sourcepub const UINT64: &'static Signature
pub const UINT64: &'static Signature
Unsigned 64-bit integer
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store(10u64);
assert_eq!(body.signature(), Signature::UINT64);Sourcepub const DOUBLE: &'static Signature
pub const DOUBLE: &'static Signature
IEEE 754 double-precision floating point
§Examples
use tokio_dbus::{BodyBuf, Signature};
let mut body = BodyBuf::new();
body.store(3.1415f64);
assert_eq!(body.signature(), Signature::DOUBLE);Sourcepub const UNIX_FD: &'static Signature
pub const UNIX_FD: &'static Signature
Unsigned 32-bit integer representing an index into an out-of-band array of file descriptors, transferred via some platform-specific mechanism (mnemonic: h for handle)
Sourcepub fn new<S>(signature: &S) -> Result<&Signature, SignatureError>
pub fn new<S>(signature: &S) -> Result<&Signature, SignatureError>
Try to construct a new signature with validation.
Sourcepub const unsafe fn new_unchecked(signature: &[u8]) -> &Signature
pub const unsafe fn new_unchecked(signature: &[u8]) -> &Signature
Construct a new signature without validation. The caller is responsible for ensuring that the signature is valid.
§Safety
The caller must ensure that the signature is a valid signature.
pub fn iter(&self) -> Iter<'_>
Trait Implementations§
impl Arguments for Signature
Source§impl AsRef<Signature> for SignatureBuf
impl AsRef<Signature> for SignatureBuf
Source§impl Borrow<Signature> for SignatureBuf
impl Borrow<Signature> for SignatureBuf
Source§impl Display for Signature
Format the signature as the string of type codes it consists of.
impl Display for Signature
Format the signature as the string of type codes it consists of.
§Examples
use tokio_dbus::Signature;
assert_eq!(Signature::new("a{sv}")?.to_string(), "a{sv}");impl Eq for Signature
Source§impl PartialEq<&Signature> for SignatureBuf
Equality check between a borrowed Signature and SignatureBuf.
impl PartialEq<&Signature> for SignatureBuf
Equality check between a borrowed Signature and SignatureBuf.
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(SignatureBuf::empty(), *Signature::EMPTY);
assert_eq!(SignatureBuf::new(b"s")?, *Signature::STRING);Source§impl PartialEq<&str> for Signature
impl PartialEq<&str> for Signature
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(*Signature::EMPTY, *"");
assert_eq!(*Signature::STRING, *"s");Source§impl PartialEq<Signature> for SignatureBuf
impl PartialEq<Signature> for SignatureBuf
Source§impl PartialEq<SignatureBuf> for Signature
Equality check between SignatureBuf and Signature.
impl PartialEq<SignatureBuf> for Signature
Equality check between SignatureBuf and Signature.
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(*Signature::EMPTY, SignatureBuf::empty());
assert_eq!(*Signature::STRING, SignatureBuf::new(b"s")?);Source§impl PartialEq<SignatureBuf> for &Signature
Equality check between SignatureBuf and a borrowed Signature.
impl PartialEq<SignatureBuf> for &Signature
Equality check between SignatureBuf and a borrowed Signature.
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(Signature::EMPTY, SignatureBuf::empty());
assert_eq!(Signature::STRING, SignatureBuf::new(b"s")?);Source§impl<const N: usize> PartialEq<[u8; N]> for Signature
Equality check between [[u8; N]] and a Signature.
impl<const N: usize> PartialEq<[u8; N]> for Signature
Equality check between [[u8; N]] and a Signature.
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(Signature::EMPTY, b"");
assert_eq!(Signature::STRING, b"s");Source§impl<const N: usize> PartialEq<[u8; N]> for &Signature
Equality check between [[u8; N]] and a borrowed Signature.
impl<const N: usize> PartialEq<[u8; N]> for &Signature
Equality check between [[u8; N]] and a borrowed Signature.
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(Signature::EMPTY, b"");
assert_eq!(Signature::STRING, b"s");Source§impl PartialEq<[u8]> for Signature
Equality check between [[u8]] and a Signature.
impl PartialEq<[u8]> for Signature
Equality check between [[u8]] and a Signature.
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(*Signature::EMPTY, b""[..]);
assert_eq!(*Signature::STRING, b"s"[..]);Source§impl PartialEq<[u8]> for &Signature
Equality check between [[u8]] and a borrowed Signature.
impl PartialEq<[u8]> for &Signature
Equality check between [[u8]] and a borrowed Signature.
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(Signature::EMPTY, b""[..]);
assert_eq!(Signature::STRING, b"s"[..]);Source§impl PartialEq<str> for Signature
impl PartialEq<str> for Signature
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(*Signature::EMPTY, *"");
assert_eq!(*Signature::STRING, *"s");Source§impl PartialEq<str> for &Signature
impl PartialEq<str> for &Signature
§Examples
use tokio_dbus::{Signature, SignatureBuf};
assert_eq!(Signature::EMPTY, *"");
assert_eq!(Signature::STRING, *"s");impl Read for Signature
impl Storable for &Signature
Storable implementation for &Signature.
§Examples
use tokio_dbus::BodyBuf;
use tokio_dbus::Signature;
let mut body = BodyBuf::new();
body.store(10u16)?;
body.store(Signature::new("us")?)?;
assert_eq!(body.signature(), "qg");