pub struct OwnedObjectPath(/* private fields */);
Expand description

A validated owned object path.

The following rules define a valid object path. Implementations must not send or accept messages with invalid object paths.

  • The path may be of any length.
  • The path must begin with an ASCII ‘/’ (integer 47) character, and must consist of elements separated by slash characters.
  • Each element must only contain the ASCII characters “[A-Z][a-z][0-9]_”
  • No element may be the empty string.
  • Multiple ‘/’ characters cannot occur in sequence.
  • A trailing ‘/’ character is not allowed unless the path is the root path (a single ‘/’ character).

Methods from Deref<Target = ObjectPath>§

source

pub const ROOT: &'static Self = _

source

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

Construct an iterator over the object path.

Examples
use tokio_dbus::ObjectPath;

let mut it = ObjectPath::new_const(b"/").iter();
assert!(it.next().is_none());

let mut it = ObjectPath::new_const(b"/foo").iter();
assert_eq!(it.next(), Some("foo"));
assert!(it.next().is_none());

let mut it = ObjectPath::new_const(b"/foo/bar").iter();
assert_eq!(it.next_back(), Some("bar"));
assert_eq!(it.next(), Some("foo"));
assert!(it.next().is_none());
source

pub fn starts_with(&self, other: &ObjectPath) -> bool

Test if one part starts with another.

Examples
use tokio_dbus::ObjectPath;

const FOO: &ObjectPath = ObjectPath::new_const(b"/foo");
const FOO_BAR: &ObjectPath = ObjectPath::new_const(b"/foo/bar");

assert!(FOO_BAR.starts_with(FOO));

Trait Implementations§

source§

impl AsRef<ObjectPath> for OwnedObjectPath

source§

fn as_ref(&self) -> &ObjectPath

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

impl Borrow<ObjectPath> for OwnedObjectPath

source§

fn borrow(&self) -> &ObjectPath

Immutably borrows from an owned value. Read more
source§

impl Clone for OwnedObjectPath

source§

fn clone(&self) -> OwnedObjectPath

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 Deref for OwnedObjectPath

§

type Target = ObjectPath

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl PartialEq for OwnedObjectPath

source§

fn eq(&self, other: &OwnedObjectPath) -> 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 OwnedObjectPath

source§

impl StructuralEq for OwnedObjectPath

source§

impl StructuralPartialEq for OwnedObjectPath

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere 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.