dbus_message_parser/match_rule/
arg_path.rs

1use crate::value::ObjectPath;
2use std::fmt::{Display, Formatter, Result as FmtResult};
3
4#[derive(Debug, PartialEq, Eq)]
5pub struct ArgPath(usize, ObjectPath);
6
7impl ArgPath {
8    pub fn get_key(&self) -> String {
9        format!("arg{}path", self.get_index())
10    }
11
12    pub fn get_index(&self) -> usize {
13        self.0
14    }
15
16    pub fn get_value(&self) -> &ObjectPath {
17        &self.1
18    }
19}
20
21impl From<(usize, ObjectPath)> for ArgPath {
22    fn from(arg: (usize, ObjectPath)) -> Self {
23        ArgPath(arg.0, arg.1)
24    }
25}
26
27impl Display for ArgPath {
28    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
29        write!(f, "{}", &self.1)
30    }
31}