Skip to main content

Resolver

Struct Resolver 

Source
pub struct Resolver<'a> { /* private fields */ }
Expand description

Resolves references, fetching each distinct path once.

Implementations§

Source§

impl<'a> Resolver<'a>

Source

pub fn new(source: &'a dyn SecretSource) -> Resolver<'a>

Source

pub fn fetches(&self) -> usize

How many distinct paths have been fetched.

Source

pub async fn value(&mut self, key: &str, value: &str) -> Result<Option<String>>

Resolve one value, or None if it was not a reference.

Source

pub async fn pairs( &mut self, pairs: &mut BTreeMap<String, String>, ) -> Result<usize>

Resolve every reference in a flat map, in place, and say how many.

This is the shape a parsed .env comes in, and the shape anything else keyed by name can be put into.

Source

pub async fn config(&mut self, config: &Config, roots: &[&str]) -> Result<usize>

Resolve every reference under each of these configuration paths.

The roots have to be named because Config offers no way to enumerate its top level, and a resolver that guessed at namespaces would be the runtime magic this framework does without. Each root is a dotted path and its whole subtree is searched, so "database" covers database.connections.pgsql.password.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Resolver<'a>

§

impl<'a> !UnwindSafe for Resolver<'a>

§

impl<'a> Freeze for Resolver<'a>

§

impl<'a> Send for Resolver<'a>

§

impl<'a> Sync for Resolver<'a>

§

impl<'a> Unpin for Resolver<'a>

§

impl<'a> UnsafeUnpin for Resolver<'a>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.