struct ConfigInclude {
path: PathBuf,
def: Definition,
optional: bool,
}Expand description
Represents a config-include value in the configuration.
This intentionally doesn’t derive serde deserialization
to avoid any misuse of GlobalContext::get::<ConfigInclude>(),
which might lead to wrong config loading order.
Fields§
§path: PathBufPath to a config-include configuration file. Could be either relative or absolute.
def: Definition§optional: boolWhether this include is optional (missing files are silently ignored)
Implementations§
Source§impl ConfigInclude
impl ConfigInclude
fn new(p: impl Into<PathBuf>, def: Definition) -> Self
Sourcefn resolve_path(&self, gctx: &GlobalContext) -> Option<PathBuf>
fn resolve_path(&self, gctx: &GlobalContext) -> Option<PathBuf>
Resolves the absolute path for this include.
For file based include,
it is relative to parent directory of the config file includes it.
For example, if .cargo/config.toml has a include = “foo.toml”, Cargo will load .cargo/foo.toml`.
For CLI based include (e.g., --config 'include = "foo.toml"'),
it is relative to the current working directory.
Returns None if this is an optional include and the file doesn’t exist.
Otherwise returns Some(PathBuf) with the absolute path.
Auto Trait Implementations§
impl Freeze for ConfigInclude
impl RefUnwindSafe for ConfigInclude
impl Send for ConfigInclude
impl Sync for ConfigInclude
impl Unpin for ConfigInclude
impl UnwindSafe for ConfigInclude
Blanket Implementations§
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
§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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes