Skip to main content

Source

Struct Source 

Source
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

Source

pub fn parse(input: &str) -> Result<Source, ParseError>

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.

Source

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.

Source

pub fn source(&self) -> &str

Source

pub fn source_mut(&mut self) -> &mut String

Source

pub fn set_source(&mut self, source: impl Into<String>)

Source

pub fn with_source(self, source: impl Into<String>) -> Source

Source

pub fn options(&self) -> &Options

Source

pub fn options_mut(&mut self) -> &mut Options

Source

pub fn set_options(&mut self, options: Options)

Source

pub fn with_options(self, options: Options) -> Source

Source

pub fn set_option<K, V>(&mut self, key: K, value: V)
where K: Into<String>, V: Into<OptionValue>,

Source

pub fn with_option<K, V>(self, key: K, value: V) -> Source
where K: Into<String>, V: Into<OptionValue>,

Source

pub fn resource(&self) -> &str

Source

pub fn resource_mut(&mut self) -> &mut String

Source

pub fn set_resource(&mut self, resource: impl Into<String>)

Source

pub fn with_resource(self, resource: impl Into<String>) -> Source

Source

pub fn resource_colon(&self) -> bool

Source

pub fn set_resource_colon(&mut self, resource_colon: bool)

Source

pub fn with_resource_colon(self, resource_colon: bool) -> Source

Trait Implementations§

Source§

impl Clone for Source

Source§

fn clone(&self) -> Source

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Source

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for Source

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl FromStr for Source

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(value: &str) -> Result<Source, <Source as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for Source

Source§

fn eq(&self, other: &Source) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Source

Source§

impl TryFrom<&String> for Source

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from( value: &String, ) -> Result<Source, <Source as TryFrom<&String>>::Error>

Performs the conversion.
Source§

impl TryFrom<&str> for Source

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(value: &str) -> Result<Source, <Source as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl TryFrom<Cow<'_, str>> for Source

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from( value: Cow<'_, str>, ) -> Result<Source, <Source as TryFrom<Cow<'_, str>>>::Error>

Performs the conversion.
Source§

impl TryFrom<String> for Source

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(value: String) -> Result<Source, <Source as TryFrom<String>>::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more