[−][src]Struct etcetera::app_strategy::Unix
This strategy has no standard or official specification. It has arisen over time through hundreds of Unixy tools. Vim and Cargo are notable examples whose configuration/data/cache directory layouts are similar to those created by this strategy.
use etcetera::app_strategy::AppStrategy; use etcetera::app_strategy::AppStrategyArgs; use etcetera::app_strategy::Unix; use std::path::Path; let app_strategy = Unix::new(AppStrategyArgs { top_level_domain: "org".to_string(), author: "Bram Moolenar".to_string(), app_name: "Vim".to_string(), }).unwrap(); let home_dir = etcetera::home_dir().unwrap(); assert_eq!( app_strategy.config_dir().strip_prefix(&home_dir), Ok(Path::new(".vim/") )); assert_eq!( app_strategy.data_dir().strip_prefix(&home_dir), Ok(Path::new(".vim/data/") )); assert_eq!( app_strategy.cache_dir().strip_prefix(&home_dir), Ok(Path::new(".vim/cache/") ));
Trait Implementations
impl AppStrategy for Unix
[src]
type CreationError = HomeDirError
The error type returned by new
.
fn new(args: AppStrategyArgs) -> Result<Self, Self::CreationError>
[src]
fn config_dir(&self) -> PathBuf
[src]
fn data_dir(&self) -> PathBuf
[src]
fn cache_dir(&self) -> PathBuf
[src]
fn config_file<FileName: AsRef<OsStr>>(&self, file_name: FileName) -> PathBuf
[src]
fn data_file<FileName: AsRef<OsStr>>(&self, file_name: FileName) -> PathBuf
[src]
fn cache_file<FileName: AsRef<OsStr>>(&self, file_name: FileName) -> PathBuf
[src]
impl Debug for Unix
[src]
Auto Trait Implementations
impl RefUnwindSafe for Unix
impl Send for Unix
impl Sync for Unix
impl Unpin for Unix
impl UnwindSafe for Unix
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,