Struct tokio_dbus::ObjectPathBuf
source · pub struct ObjectPathBuf(/* 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>§
pub const ROOT: &'static Self = _
sourcepub fn iter(&self) -> Iter<'_>
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());
sourcepub fn starts_with(&self, other: &ObjectPath) -> bool
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 ObjectPathBuf
impl AsRef<ObjectPath> for ObjectPathBuf
source§fn as_ref(&self) -> &ObjectPath
fn as_ref(&self) -> &ObjectPath
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Borrow<ObjectPath> for ObjectPathBuf
impl Borrow<ObjectPath> for ObjectPathBuf
source§fn borrow(&self) -> &ObjectPath
fn borrow(&self) -> &ObjectPath
Immutably borrows from an owned value. Read more
source§impl Clone for ObjectPathBuf
impl Clone for ObjectPathBuf
source§fn clone(&self) -> ObjectPathBuf
fn clone(&self) -> ObjectPathBuf
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Deref for ObjectPathBuf
impl Deref for ObjectPathBuf
source§impl PartialEq for ObjectPathBuf
impl PartialEq for ObjectPathBuf
source§fn eq(&self, other: &ObjectPathBuf) -> bool
fn eq(&self, other: &ObjectPathBuf) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for ObjectPathBuf
impl StructuralPartialEq for ObjectPathBuf
Auto Trait Implementations§
impl RefUnwindSafe for ObjectPathBuf
impl Send for ObjectPathBuf
impl Sync for ObjectPathBuf
impl Unpin for ObjectPathBuf
impl UnwindSafe for ObjectPathBuf
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more