wdg_uri/path/mod.rs
1use string_repr::StringRepr;
2
3#[macro_export]
4macro_rules! path {
5 ($path:expr) => {
6 Path::new($path)
7 };
8}
9
10pub struct Path<'a>(&'a str);
11
12impl<'a> Path<'a> {
13 /// Create new Path.
14 /// # Example:
15 /// ```rust
16 /// use wdg_uri::path::Path;
17 /// let path = Path::new("/");
18 /// ```
19 pub fn new(data: &str) -> Path {
20 Path(data)
21 }
22}
23
24impl<'a> StringRepr for Path<'a> {
25 fn string_repr(&self) -> String {
26 String::from(self.0)
27 }
28}