use crate::AppPath;
use std::borrow::Borrow;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use std::ops::Deref;
use std::path::{Path, PathBuf};
impl Default for AppPath {
#[inline]
fn default() -> Self {
Self::new()
}
}
impl std::fmt::Display for AppPath {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.full_path.display())
}
}
impl AsRef<Path> for AppPath {
#[inline]
fn as_ref(&self) -> &Path {
&self.full_path
}
}
impl From<&str> for AppPath {
#[inline]
fn from(path: &str) -> Self {
Self::with(path)
}
}
impl From<String> for AppPath {
#[inline]
fn from(path: String) -> Self {
Self::with(path)
}
}
impl From<&String> for AppPath {
#[inline]
fn from(path: &String) -> Self {
Self::with(path)
}
}
impl From<&Path> for AppPath {
#[inline]
fn from(path: &Path) -> Self {
Self::with(path)
}
}
impl From<PathBuf> for AppPath {
#[inline]
fn from(path: PathBuf) -> Self {
Self::with(path)
}
}
impl From<&PathBuf> for AppPath {
#[inline]
fn from(path: &PathBuf) -> Self {
Self::with(path)
}
}
impl PartialEq for AppPath {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.full_path == other.full_path
}
}
impl Eq for AppPath {}
impl PartialOrd for AppPath {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for AppPath {
#[inline]
fn cmp(&self, other: &Self) -> Ordering {
self.full_path.cmp(&other.full_path)
}
}
impl Hash for AppPath {
#[inline]
fn hash<H: Hasher>(&self, state: &mut H) {
self.full_path.hash(state);
}
}
impl Deref for AppPath {
type Target = Path;
#[inline]
fn deref(&self) -> &Self::Target {
&self.full_path
}
}
impl Borrow<Path> for AppPath {
#[inline]
fn borrow(&self) -> &Path {
&self.full_path
}
}
impl AsRef<std::ffi::OsStr> for AppPath {
#[inline]
fn as_ref(&self) -> &std::ffi::OsStr {
self.full_path.as_os_str()
}
}
impl From<AppPath> for PathBuf {
#[inline]
fn from(app_path: AppPath) -> Self {
app_path.full_path
}
}
impl From<AppPath> for std::ffi::OsString {
#[inline]
fn from(app_path: AppPath) -> Self {
app_path.full_path.into_os_string()
}
}