[][src]Struct zvariant::ObjectPath

pub struct ObjectPath<'a>(_);

String that identifies objects at a given destination on the D-Bus bus.

Mostly likely this is only useful in the D-Bus context.

Examples

use core::convert::TryFrom;
use zvariant::ObjectPath;

// Valid object paths
let o = ObjectPath::try_from("/").unwrap();
assert_eq!(o, "/");
let o = ObjectPath::try_from("/Path/t0/0bject").unwrap();
assert_eq!(o, "/Path/t0/0bject");
let o = ObjectPath::try_from("/a/very/looooooooooooooooooooooooo0000o0ng/path").unwrap();
assert_eq!(o, "/a/very/looooooooooooooooooooooooo0000o0ng/path");

// Invalid object paths
ObjectPath::try_from("").unwrap_err();
ObjectPath::try_from("/double//slashes/").unwrap_err();
ObjectPath::try_from(".").unwrap_err();
ObjectPath::try_from("/end/with/slash/").unwrap_err();
ObjectPath::try_from("/ha.d").unwrap_err();

Implementations

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

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

The object path as a string.

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

The object path as bytes.

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

Create a new ObjectPath from given bytes.

Since the passed bytes are not checked for correctness, prefer using the TryFrom<&[u8]> implementation.

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

Create a new ObjectPath from the given string.

Since the passed string is not checked for correctness, prefer using the TryFrom<&str> implementation.

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

Same as from_str_unchecked, except it takes an owned String.

Since the passed string is not checked for correctness, prefer using the TryFrom<String> implementation.

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

the object path's length.

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

if the object path is empty.

Trait Implementations

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

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

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

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

type Target = str

The resulting type after dereferencing.

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

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

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

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

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

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

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

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

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

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

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

type Error = Error

The type returned in the event of a conversion error.

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

type Error = Error

The type returned in the event of a conversion error.

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

type Error = Error

The type returned in the event of a conversion error.

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

type Error = Error

The type returned in the event of a conversion error.

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

Try to create an ObjectPath from a string.

type Error = Error

The type returned in the event of a conversion error.

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

type Error = Error

The type returned in the event of a conversion error.

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

type Error = Error

The type returned in the event of a conversion error.

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

type Error = Error

The type returned in the event of a conversion error.

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for ObjectPath<'a>

impl<'a> Send for ObjectPath<'a>

impl<'a> Sync for ObjectPath<'a>

impl<'a> Unpin for ObjectPath<'a>

impl<'a> UnwindSafe for ObjectPath<'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.