[][src]Struct zvariant::Signature

pub struct Signature<'a>(_);

String that identifies the type of an encoded value.

Examples

use core::convert::TryFrom;
use zvariant::Signature;

// Valid signatures
let s = Signature::try_from("").unwrap();
assert_eq!(s, "");
let s = Signature::try_from("y").unwrap();
assert_eq!(s, "y");
let s = Signature::try_from("xs").unwrap();
assert_eq!(s, "xs");
let s = Signature::try_from("(ysa{sd})").unwrap();
assert_eq!(s, "(ysa{sd})");
let s = Signature::try_from("a{sd}").unwrap();
assert_eq!(s, "a{sd}");

// Invalid signatures
Signature::try_from("z").unwrap_err();
Signature::try_from("(xs").unwrap_err();
Signature::try_from("xs)").unwrap_err();
Signature::try_from("s/").unwrap_err();
Signature::try_from("a").unwrap_err();
Signature::try_from("a{yz}").unwrap_err();

Implementations

impl<'a> Signature<'a>[src]

pub fn as_str(&self) -> &str[src]

The signature as a string.

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

The signature bytes.

pub fn from_bytes_unchecked<'s: 'a>(bytes: &'s [u8]) -> Self[src]

Create a new Signature from given bytes.

Since the passed bytes are not checked for correctness, it's provided for ease of Type implementations.

pub fn from_str_unchecked<'s: 'a>(signature: &'s str) -> Self[src]

Same as from_bytes_unchecked, except it takes a string reference.

pub fn from_string_unchecked(signature: String) -> Self[src]

Same as from_str_unchecked, except it takes an owned String.

pub fn len(&self) -> usize[src]

the signature's length.

pub fn is_empty(&self) -> bool[src]

if the signature is empty.

pub fn to_owned(&self) -> Signature<'static>[src]

Creates an owned clone of self.

pub fn into_owned(self) -> Signature<'static>[src]

Creates an owned clone of self.

Trait Implementations

impl<'a> Basic for Signature<'a>[src]

impl<'a> Clone for Signature<'a>[src]

impl<'a> Debug for Signature<'a>[src]

impl<'a> Deref for Signature<'a>[src]

type Target = str

The resulting type after dereferencing.

impl<'de: 'a, 'a> Deserialize<'de> for Signature<'a>[src]

impl<'a> Display for Signature<'a>[src]

impl<'a> Eq for Signature<'a>[src]

impl<'a, '_> From<&'_ Signature<'a>> for String[src]

impl<'a> From<&'a Signature<'a>> for Value<'a>[src]

impl From<OwnedSignature> for Signature<'static>[src]

impl<'a> From<Signature<'a>> for String[src]

impl<'a> From<Signature<'a>> for OwnedSignature[src]

impl<'a> From<Signature<'a>> for Value<'a>[src]

impl<'a> Hash for Signature<'a>[src]

impl<'a, '_> PartialEq<&'_ str> for Signature<'a>[src]

impl<'a> PartialEq<Signature<'a>> for Signature<'a>[src]

impl<'a> Serialize for Signature<'a>[src]

impl<'a> StructuralEq for Signature<'a>[src]

impl<'a> StructuralPartialEq for Signature<'a>[src]

impl<'a> TryFrom<&'a [u8]> for Signature<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a OwnedValue> for &'a Signature<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Value<'a>> for &'a Signature<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Value<'a>> for Signature<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a str> for Signature<'a>[src]

Try to create a Signature from a string.

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<OwnedValue> for Signature<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<String> for Signature<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<Value<'a>> for Signature<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> Type for Signature<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Signature<'a>

impl<'a> Send for Signature<'a>

impl<'a> Sync for Signature<'a>

impl<'a> Unpin for Signature<'a>

impl<'a> UnwindSafe for Signature<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.