Skip to main content

logic_eval_util/
str.rs

1use std::ops;
2
3#[derive(PartialEq, Eq, Hash, Debug, Clone)]
4pub struct StrPath<'a> {
5    pub is_absolute: bool,
6    pub path: &'a str,
7}
8
9impl<'a> StrPath<'a> {
10    pub const fn absolute(path: &'a str) -> Self {
11        Self {
12            is_absolute: true,
13            path,
14        }
15    }
16
17    pub const fn relative(path: &'a str) -> Self {
18        Self {
19            is_absolute: false,
20            path,
21        }
22    }
23}
24
25impl ops::Deref for StrPath<'_> {
26    type Target = str;
27
28    fn deref(&self) -> &Self::Target {
29        self.path
30    }
31}