Struct tokio_dbus::OwnedObjectPath
source · 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>§
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 OwnedObjectPath
impl AsRef<ObjectPath> for OwnedObjectPath
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 OwnedObjectPath
impl Borrow<ObjectPath> for OwnedObjectPath
source§fn borrow(&self) -> &ObjectPath
fn borrow(&self) -> &ObjectPath
Immutably borrows from an owned value. Read more
source§impl Clone for OwnedObjectPath
impl Clone for OwnedObjectPath
source§fn clone(&self) -> OwnedObjectPath
fn clone(&self) -> OwnedObjectPath
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 OwnedObjectPath
impl Deref for OwnedObjectPath
source§impl PartialEq for OwnedObjectPath
impl PartialEq for OwnedObjectPath
source§fn eq(&self, other: &OwnedObjectPath) -> bool
fn eq(&self, other: &OwnedObjectPath) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl Eq for OwnedObjectPath
impl StructuralEq for OwnedObjectPath
impl StructuralPartialEq for OwnedObjectPath
Auto Trait Implementations§
impl RefUnwindSafe for OwnedObjectPath
impl Send for OwnedObjectPath
impl Sync for OwnedObjectPath
impl Unpin for OwnedObjectPath
impl UnwindSafe for OwnedObjectPath
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