A library for writing host-specific, single-binary configuration management and deployment tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
863 B

use std::path::{Path as ActualPath, PathBuf};
#[derive(Clone, Debug)]
pub struct Path(PathBuf);
// FIXME: This is a specialization since with Path: Into<PathBuf>
// it would overwrite impl<T> From <T> for T
//impl<T: Into<PathBuf>> From<T> for Path {
// fn from(v: T) -> Self {
// Path(v.into())
// }
//}
macro_rules! path_from {
( $t:ty ) => {
impl From<$t> for Path {
fn from(v: $t) -> Self {
Self(v.into())
}
}
};
}
path_from!(String);
path_from!(&str);
path_from!(PathBuf);
impl From<Path> for PathBuf {
fn from(v: Path) -> Self {
v.0
}
}
impl AsRef<ActualPath> for Path {
fn as_ref(&self) -> &ActualPath {
&self.0
}
}
#[derive(Clone, Debug)]
pub struct UserName(pub String);
#[derive(Clone, Debug)]
pub struct ServiceName(pub String);
#[derive(Clone, Debug)]
pub struct DatabaseName(pub String);