Struct zvariant::Signature [−][src]
pub struct Signature<'a> { /* fields omitted */ }
Expand description
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();
This is implemented so that multiple instances can share the same underlying signature string.
Use slice
method to create new signature that represents a portion of a signature
Implementations
Create a new Signature from given bytes.
Since the passed bytes are not checked for correctness, it’s provided for ease of
Type
implementations.
Same as from_bytes_unchecked
, except it takes a static reference.
Same as from_bytes_unchecked
, except it takes a string reference.
Same as from_str_unchecked
, except it takes a static string reference.
Same as from_str_unchecked
, except it takes an owned String
.
Creates an owned clone of self
.
Returns a slice of self
for the provided range.
Panics
Requires that begin <= end and end <= self.len(), otherwise slicing will panic.
Trait Implementations
The type signature, as a character.
The type signature, as a string.
Please use the alignment
function instead
The required padding alignment.
The required padding alignment for the given format.
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
Try to create a Signature from a string.
Auto Trait Implementations
impl<'a> RefUnwindSafe for Signature<'a>
impl<'a> UnwindSafe for Signature<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more