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<Self, ParseError>
Sourcepub fn named(name: impl Into<String>) -> Self
pub fn named(name: impl Into<String>) -> Self
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>) -> Self
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) -> Self
pub fn set_option<K: Into<String>, V: Into<OptionValue>>( &mut self, key: K, value: V, )
pub fn with_option<K: Into<String>, V: Into<OptionValue>>( self, key: K, value: V, ) -> Self
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>) -> Self
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) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Source
impl<'de> Deserialize<'de> for Source
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Source> for SourceBuilder
impl From<Source> for SourceBuilder
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