mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 07:09:59 -07:00
brk: first commit
This commit is contained in:
24
_src/structs/map_path.rs
Normal file
24
_src/structs/map_path.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use allocative::Allocative;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
|
||||
#[derive(Debug, Clone, Deref, DerefMut, Allocative)]
|
||||
pub struct MapPath(PathBuf);
|
||||
|
||||
impl MapPath {
|
||||
pub fn join(&self, path: &str) -> Self {
|
||||
let path = path.replace(['-', '_', ' '], "/");
|
||||
Self(self.0.join(path))
|
||||
}
|
||||
|
||||
pub fn unwrap(&self) -> &PathBuf {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PathBuf> for MapPath {
|
||||
fn from(value: PathBuf) -> Self {
|
||||
Self(value)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user