pub struct SignatureBuf { /* private fields */ }
Expand description

A D-Bus signature.

This is the owned variant which dereferences to Signature.

Implementations§

source§

impl SignatureBuf

source

pub const fn empty() -> SignatureBuf

Construct a new empty signature.

§Examples
use tokio_dbus::SignatureBuf;

let sig = SignatureBuf::empty();
assert!(sig.is_empty());
source

pub const fn into_raw_parts(self) -> ([MaybeUninit<u8>; 256], usize)

Convert an owned signature into its raw parts.

source

pub const fn new_const(signature: &[u8]) -> SignatureBuf

Construct a new signature with validation inside of a constant context.

This will panic in case the signature is invalid.

use tokio_dbus::SignatureBuf;

const BAD: SignatureBuf = SignatureBuf::new_const(b"(a)");
§Examples
use tokio_dbus::SignatureBuf;

const SIG: SignatureBuf = SignatureBuf::new_const(b"i(ai)");
source

pub fn new(signature: &[u8]) -> Result<SignatureBuf, SignatureError>

Try to construct a new signature with validation.

Methods from Deref<Target = Signature>§

source

pub const EMPTY: &'static Signature = _

source

pub const SIGNATURE: &'static Signature = _

source

pub const OBJECT_PATH: &'static Signature = _

source

pub const STRING: &'static Signature = _

source

pub const VARIANT: &'static Signature = _

source

pub const BYTE: &'static Signature = _

source

pub const INT16: &'static Signature = _

source

pub const UINT16: &'static Signature = _

source

pub const INT32: &'static Signature = _

source

pub const UINT32: &'static Signature = _

source

pub const INT64: &'static Signature = _

source

pub const UINT64: &'static Signature = _

source

pub const DOUBLE: &'static Signature = _

source

pub const UNIX_FD: &'static Signature = _

source

pub fn is_empty(&self) -> bool

Test if the signature is empty.

source

pub fn len(&self) -> usize

Get the length of the signature in bytes.

source

pub fn iter(&self) -> Iter<'_>

source

pub fn as_str(&self) -> &str

Get the signature as a string.

source

pub fn as_bytes(&self) -> &[u8]

Get the signature as a byte slice.

Trait Implementations§

source§

impl AsRef<Signature> for SignatureBuf

source§

fn as_ref(&self) -> &Signature

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<Signature> for SignatureBuf

source§

fn borrow(&self) -> &Signature

Immutably borrows from an owned value. Read more
source§

impl Clone for SignatureBuf

source§

fn clone(&self) -> SignatureBuf

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SignatureBuf

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Deref for SignatureBuf

§

type Target = Signature

The resulting type after dereferencing.
source§

fn deref(&self) -> &<SignatureBuf as Deref>::Target

Dereferences the value.
source§

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§

fn eq(&self, other: &&Signature) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Signature> for SignatureBuf

Equality check between Signature and SignatureBuf.

§Examples

use tokio_dbus::{Signature, SignatureBuf};

assert_eq!(SignatureBuf::empty(), *Signature::EMPTY);
assert_eq!(SignatureBuf::new(b"s")?, *Signature::STRING);
source§

fn eq(&self, other: &Signature) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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§

fn eq(&self, other: &SignatureBuf) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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§

fn eq(&self, other: &SignatureBuf) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for SignatureBuf

Equality check between SignatureBuf and SignatureBuf.

§Examples

use tokio_dbus::{Signature, SignatureBuf};

assert_eq!(SignatureBuf::empty(), Signature::EMPTY.to_owned());
assert_eq!(SignatureBuf::new(b"s")?, Signature::STRING.to_owned());
source§

fn eq(&self, other: &SignatureBuf) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for SignatureBuf

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.