Enum sea_orm_rocket::figment::Source [−]
#[non_exhaustive]
pub enum Source {
File(PathBuf),
Code(&'static Location<'static>),
Custom(String),
}Expand description
The source for a configuration value.
The Source of a given value can be determined via that value’s
Metadata.source retrievable via the value’s
Tag (via Value::tag() or via the magic value Tagged) and
Figment::get_metadata().
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
File(PathBuf)
Tuple Fields
0: PathBufA file: the path to the file.
Code(&'static Location<'static>)
Tuple Fields
0: &'static Location<'static>Some programatic value: the source location.
Custom(String)
Tuple Fields
0: StringA custom source all-together.
Implementations
impl Source
impl Source
Returns the path to the source file if self.kind is Kind::File.
Example
use std::path::Path;
use figment::Source;
let source = Source::from(Path::new("a/b/c.txt"));
assert_eq!(source.file_path(), Some(Path::new("a/b/c.txt")));pub fn code_location(&self) -> Option<&'static Location<'static>>
pub fn code_location(&self) -> Option<&'static Location<'static>>
Returns the location to the source code if self is Source::Code.
Example
use std::panic::Location;
use figment::Source;
let location = Location::caller();
let source = Source::Code(location);
assert_eq!(source.code_location(), Some(location));Trait Implementations
Displays the source. Location and custom sources are displayed directly. File paths are displayed relative to the current working directory if the relative path is shorter than the complete path.
impl StructuralPartialEq for Source
Auto Trait Implementations
impl RefUnwindSafe for Source
impl UnwindSafe for Source
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self into a collection.
pub fn vzip(self) -> V
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
