[−][src]Struct zvariant::Signature
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 from_str_unchecked<'s: 'a>(signature: &'s str) -> Self
[src]
Create a new Signature from given string.
Since the passed string is not checked for correctness, it's provided for ease of
Type
implementations.
pub fn from_string_unchecked(signature: String) -> Self
[src]
Same as from_str_unchecked
, except it takes an owned String
.
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]
impl<'de: 'a, 'a> Deserialize<'de> for Signature<'a>
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
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<Signature<'a>> for String
[src]
impl<'a> From<Signature<'a>> for Value<'a>
[src]
impl<'a> Hash for Signature<'a>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, '_> PartialEq<&'_ str> for Signature<'a>
[src]
impl<'a> PartialEq<Signature<'a>> for Signature<'a>
[src]
impl<'a> Serialize for Signature<'a>
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'a> StructuralEq for Signature<'a>
[src]
impl<'a> StructuralPartialEq for Signature<'a>
[src]
impl<'a> TryFrom<&'a OwnedValue> for &'a Signature<'a>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(v: &'a OwnedValue) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a Value<'a>> for &'a Signature<'a>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: &'a Value<'a>) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a Value<'a>> for Signature<'a>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: &'a Value) -> Result<Self, Self::Error>
[src]
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.
fn try_from(value: &'a str) -> Result<Self>
[src]
impl<'a> TryFrom<OwnedValue> for Signature<'a>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(v: OwnedValue) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<String> for Signature<'a>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: String) -> Result<Self>
[src]
impl<'a> TryFrom<Value<'a>> for Signature<'a>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: Value<'a>) -> Result<Self, Self::Error>
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,