pub struct Source { /* private fields */ }Expand description
One configuration source declaration.
See the crate-level documentation for the source string format, parsing rules, and examples.
Implementations§
Source§impl Source
impl Source
pub fn parse(input: &str) -> Result<Source, ParseError>
Sourcepub fn named(name: impl Into<String>) -> Source
pub fn named(name: impl Into<String>) -> Source
Build a bare source with just a name — no options, no resource — infallibly.
Used for synthetic origins (e.g. tanzim_value::Locations that do not come from parsing a
real source string). Unlike Source::parse this performs no validation, so the name may
even be empty for a placeholder origin.
Sourcepub fn on_error(&self, stage: Stage) -> OnError
pub fn on_error(&self, stage: Stage) -> OnError
The error policy this source declares for stage, via its reserved on_error option.
Defaults to OnError::Fail when the option is absent, malformed, or does not mention the
stage. on_error=(load=skip,validate=skip) yields OnError::Skip for those two stages.
pub fn source(&self) -> &str
pub fn source_mut(&mut self) -> &mut String
pub fn set_source(&mut self, source: impl Into<String>)
pub fn with_source(self, source: impl Into<String>) -> Source
pub fn options(&self) -> &Options
pub fn options_mut(&mut self) -> &mut Options
pub fn set_options(&mut self, options: Options)
pub fn with_options(self, options: Options) -> Source
pub fn set_option<K, V>(&mut self, key: K, value: V)
pub fn with_option<K, V>(self, key: K, value: V) -> Source
pub fn resource(&self) -> &str
pub fn resource_mut(&mut self) -> &mut String
pub fn set_resource(&mut self, resource: impl Into<String>)
pub fn with_resource(self, resource: impl Into<String>) -> Source
pub fn resource_colon(&self) -> bool
pub fn set_resource_colon(&mut self, resource_colon: bool)
pub fn with_resource_colon(self, resource_colon: bool) -> Source
Trait Implementations§
impl StructuralPartialEq for Source
Auto Trait Implementations§
impl Freeze for Source
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnsafeUnpin for Source
impl UnwindSafe for Source
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
Mutably borrows from an owned value. Read more