Struct dbus_message_parser::value::ObjectPath [−][src]
pub struct ObjectPath(_);
Expand description
This represents a object path.
Implementations
Append an element to the object path.
Returns true if the new element could be appended, otherwise false.
An element cannot be appended if the element contain a character, which is not allowed.
Example
let mut object_path = ObjectPath::try_from("/object").unwrap(); assert!(object_path.append("path")); assert!(!object_path.append("/path")); assert_eq!(&object_path, "/object/path");
Determines whether base is a prefix of self.
Example
let base = ObjectPath::try_from("/object").unwrap(); let path_1 = ObjectPath::try_from("/object/path").unwrap(); let path_2 = ObjectPath::try_from("/object_/path").unwrap(); assert!(path_1.starts_with(&base)); assert!(!path_2.starts_with(&base)); assert!(!base.starts_with(&base));
pub fn strip_prefix_elements<'a, 'b>(
&'a self,
base: &'b ObjectPath
) -> Option<Split<'a, char>>
pub fn strip_prefix_elements<'a, 'b>(
&'a self,
base: &'b ObjectPath
) -> Option<Split<'a, char>>
Returns a Split object with the prefix removed.
Example
let base = ObjectPath::try_from("/object").unwrap(); let path_1 = ObjectPath::try_from("/object/path").unwrap(); let path_2 = ObjectPath::try_from("/object_/path").unwrap(); let path_3 = ObjectPath::try_from("/object/path/element").unwrap(); let path_1_base_vec: Vec<&str> = path_1.strip_prefix_elements(&base).unwrap().collect(); let path_3_base_vec: Vec<&str> = path_3.strip_prefix_elements(&base).unwrap().collect(); assert_eq!(path_1_base_vec, vec!["path"]); assert!(path_2.strip_prefix_elements(&base).is_none()); assert_eq!(path_3_base_vec, vec!["path", "element"]); assert!(base.strip_prefix_elements(&base).is_none());
Trait Implementations
Performs the conversion.
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for ObjectPath
impl Send for ObjectPath
impl Sync for ObjectPath
impl Unpin for ObjectPath
impl UnwindSafe for ObjectPath
Blanket Implementations
Mutably borrows from an owned value. Read more