pub trait Source {
Show 14 methods
// Required methods
fn expand_bool<E>(&mut self, v: &str) -> Result<Option<bool>, E>
where E: Error;
fn expand_i8<E>(&mut self, v: &str) -> Result<Option<i8>, E>
where E: Error;
fn expand_i16<E>(&mut self, v: &str) -> Result<Option<i16>, E>
where E: Error;
fn expand_i32<E>(&mut self, v: &str) -> Result<Option<i32>, E>
where E: Error;
fn expand_i64<E>(&mut self, v: &str) -> Result<Option<i64>, E>
where E: Error;
fn expand_u8<E>(&mut self, v: &str) -> Result<Option<u8>, E>
where E: Error;
fn expand_u16<E>(&mut self, v: &str) -> Result<Option<u16>, E>
where E: Error;
fn expand_u32<E>(&mut self, v: &str) -> Result<Option<u32>, E>
where E: Error;
fn expand_u64<E>(&mut self, v: &str) -> Result<Option<u64>, E>
where E: Error;
fn expand_f32<E>(&mut self, v: &str) -> Result<Option<f32>, E>
where E: Error;
fn expand_f64<E>(&mut self, v: &str) -> Result<Option<f64>, E>
where E: Error;
fn expand_str<'a, E>(
&mut self,
v: Cow<'a, str>,
) -> Result<Expansion<Cow<'a, str>>, E>
where E: Error;
fn expand_bytes<'a, E>(
&mut self,
v: Cow<'a, [u8]>,
) -> Result<Expansion<Cow<'a, [u8]>>, E>
where E: Error;
fn expand_any<'a, E>(
&mut self,
v: Cow<'a, str>,
) -> Result<Expansion<Any<'a>, Cow<'a, str>>, E>
where E: Error;
}Expand description
A Source expands a variable string into a concrete value.
A source may choose to not expand a value and indicate that by either returning None or
Expansion::Original.
Required Methods§
Sourcefn expand_bool<E>(&mut self, v: &str) -> Result<Option<bool>, E>where
E: Error,
fn expand_bool<E>(&mut self, v: &str) -> Result<Option<bool>, E>where
E: Error,
Expands a variable string to a boolean.
Sourcefn expand_i8<E>(&mut self, v: &str) -> Result<Option<i8>, E>where
E: Error,
fn expand_i8<E>(&mut self, v: &str) -> Result<Option<i8>, E>where
E: Error,
Expands a variable string to an i8.
Sourcefn expand_i16<E>(&mut self, v: &str) -> Result<Option<i16>, E>where
E: Error,
fn expand_i16<E>(&mut self, v: &str) -> Result<Option<i16>, E>where
E: Error,
Expands a variable string to an i16.
Sourcefn expand_i32<E>(&mut self, v: &str) -> Result<Option<i32>, E>where
E: Error,
fn expand_i32<E>(&mut self, v: &str) -> Result<Option<i32>, E>where
E: Error,
Expands a variable string to an i32.
Sourcefn expand_i64<E>(&mut self, v: &str) -> Result<Option<i64>, E>where
E: Error,
fn expand_i64<E>(&mut self, v: &str) -> Result<Option<i64>, E>where
E: Error,
Expands a variable string to an i64.
Sourcefn expand_u8<E>(&mut self, v: &str) -> Result<Option<u8>, E>where
E: Error,
fn expand_u8<E>(&mut self, v: &str) -> Result<Option<u8>, E>where
E: Error,
Expands a variable string to an u8.
Sourcefn expand_u16<E>(&mut self, v: &str) -> Result<Option<u16>, E>where
E: Error,
fn expand_u16<E>(&mut self, v: &str) -> Result<Option<u16>, E>where
E: Error,
Expands a variable string to an u16.
Sourcefn expand_u32<E>(&mut self, v: &str) -> Result<Option<u32>, E>where
E: Error,
fn expand_u32<E>(&mut self, v: &str) -> Result<Option<u32>, E>where
E: Error,
Expands a variable string to an u32.
Sourcefn expand_u64<E>(&mut self, v: &str) -> Result<Option<u64>, E>where
E: Error,
fn expand_u64<E>(&mut self, v: &str) -> Result<Option<u64>, E>where
E: Error,
Expands a variable string to an u64.
Sourcefn expand_f32<E>(&mut self, v: &str) -> Result<Option<f32>, E>where
E: Error,
fn expand_f32<E>(&mut self, v: &str) -> Result<Option<f32>, E>where
E: Error,
Expands a variable string to a f32.
Sourcefn expand_f64<E>(&mut self, v: &str) -> Result<Option<f64>, E>where
E: Error,
fn expand_f64<E>(&mut self, v: &str) -> Result<Option<f64>, E>where
E: Error,
Expands a variable string to a f64.
Sourcefn expand_str<'a, E>(
&mut self,
v: Cow<'a, str>,
) -> Result<Expansion<Cow<'a, str>>, E>where
E: Error,
fn expand_str<'a, E>(
&mut self,
v: Cow<'a, str>,
) -> Result<Expansion<Cow<'a, str>>, E>where
E: Error,
Expands a variable string to string.
Sourcefn expand_bytes<'a, E>(
&mut self,
v: Cow<'a, [u8]>,
) -> Result<Expansion<Cow<'a, [u8]>>, E>where
E: Error,
fn expand_bytes<'a, E>(
&mut self,
v: Cow<'a, [u8]>,
) -> Result<Expansion<Cow<'a, [u8]>>, E>where
E: Error,
Expands bytes into other bytes.
Implementations which can expand strings, should also expand byte sequences which are valid utf-8.
Sourcefn expand_any<'a, E>(
&mut self,
v: Cow<'a, str>,
) -> Result<Expansion<Any<'a>, Cow<'a, str>>, E>where
E: Error,
fn expand_any<'a, E>(
&mut self,
v: Cow<'a, str>,
) -> Result<Expansion<Any<'a>, Cow<'a, str>>, E>where
E: Error,
Expands a variable string to Any.
Required for self-describing deserialization, where the resulting type depends on the type deserialized.
For strings this needs the same behaviour as Source::expand_str.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.