pub struct CfgPath(/* private fields */);
Expand description
A path in a configuration file: tilde expansion is performed, along
with expansion of variables provided by a CfgPathResolver
.
The tilde expansion is performed using the home directory given by the
directories
crate, which may be based on an environment variable. For more
information, see BaseDirs::home_dir
.
Alternatively, a CfgPath
can contain literal PathBuf
, which will not be expanded.
Implementations§
Source§impl CfgPath
impl CfgPath
Sourcepub fn new_literal<P>(path: P) -> CfgPath
pub fn new_literal<P>(path: P) -> CfgPath
Construct a new CfgPath
designating a literal not-to-be-expanded PathBuf
Sourcepub fn path(
&self,
path_resolver: &CfgPathResolver,
) -> Result<PathBuf, CfgPathError>
pub fn path( &self, path_resolver: &CfgPathResolver, ) -> Result<PathBuf, CfgPathError>
Return the path on disk designated by this CfgPath
.
Variables may or may not be resolved using path_resolver
, depending on whether the
expand-paths
feature is enabled or not.
Sourcepub fn as_unexpanded_str(&self) -> Option<&str>
pub fn as_unexpanded_str(&self) -> Option<&str>
If the CfgPath
is a string that should be expanded, return the (unexpanded) string,
Before use, this string would have be to expanded. So if you want a path to actually use,
call path
instead.
Returns None
if the CfgPath
is a literal PathBuf
not intended for expansion.
Sourcepub fn as_literal_path(&self) -> Option<&Path>
pub fn as_literal_path(&self) -> Option<&Path>
If the CfgPath
designates a literal not-to-be-expanded Path
, return a reference to it
Returns None
if the CfgPath
is a string which should be expanded, which is the
usual case.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CfgPath
impl<'de> Deserialize<'de> for CfgPath
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CfgPath, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CfgPath, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for CfgPath
impl Serialize for CfgPath
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for CfgPath
impl StructuralPartialEq for CfgPath
Auto Trait Implementations§
impl Freeze for CfgPath
impl RefUnwindSafe for CfgPath
impl Send for CfgPath
impl Sync for CfgPath
impl Unpin for CfgPath
impl UnwindSafe for CfgPath
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more