op_config/root.rs
1use serde::{Deserialize, Serialize};
2use std::path::{Path, PathBuf};
3
4/// A helper wrapper around the root path used during Config detection
5#[derive(Debug, PartialEq, Eq, Hash, Clone, PartialOrd, Ord, Deserialize, Serialize)]
6#[serde(transparent)]
7pub struct RootPath(pub PathBuf);
8
9impl Default for RootPath {
10 fn default() -> Self {
11 ".".into()
12 }
13}
14
15impl<P: Into<PathBuf>> From<P> for RootPath {
16 fn from(p: P) -> Self {
17 RootPath(p.into())
18 }
19}
20
21impl AsRef<Path> for RootPath {
22 fn as_ref(&self) -> &Path {
23 &self.0
24 }
25}