-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb3d3b2
commit f552917
Showing
11 changed files
with
208 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* SPDX-FileCopyrightText: © 2024 decompals */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
use std::path::{Path, PathBuf}; | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] | ||
pub struct EscapedPath(pub PathBuf); | ||
|
||
impl AsRef<PathBuf> for EscapedPath { | ||
fn as_ref(&self) -> &PathBuf { | ||
&self.0 | ||
} | ||
} | ||
|
||
impl AsRef<Path> for EscapedPath { | ||
fn as_ref(&self) -> &Path { | ||
&self.0 | ||
} | ||
} | ||
|
||
impl AsMut<PathBuf> for EscapedPath { | ||
fn as_mut(&mut self) -> &mut PathBuf { | ||
&mut self.0 | ||
} | ||
} | ||
|
||
impl From<String> for EscapedPath { | ||
fn from(value: String) -> Self { | ||
Self(PathBuf::from(value)) | ||
} | ||
} | ||
|
||
impl Default for EscapedPath { | ||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} | ||
|
||
impl EscapedPath { | ||
pub fn new() -> Self { | ||
Self(PathBuf::new()) | ||
} | ||
|
||
pub fn push(&mut self, path: EscapedPath) { | ||
self.0.push(path.0) | ||
} | ||
|
||
pub fn display(&self) -> std::path::Display { | ||
self.0.display() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.