Struct miau::builder::AsyncConfigurationBuilder[][src]

pub struct AsyncConfigurationBuilder<'provider> { /* fields omitted */ }

Configuration builder capable of using both synchronous and asynchronous sources.

This power comes at a price - it requires executor. Therefore it can only be invoked inside runtime.

Owns all sources passed to it and is capable of creating Configuration object.

Since it handles both synchronous and asynchronous sources it is possible to create async builder with only synchronous sources. It is discouraged as in such case execution is the same as in case of synchronous builder, but requires runtime.

Implementations

impl<'provider> AsyncConfigurationBuilder<'provider>[src]

pub fn new() -> Self[src]

Creates new builder.

This function is used in Default trait implementation.

use miau::builder::AsyncConfigurationBuilder;

let builder = AsyncConfigurationBuilder::new();

pub fn from_synchronous_builder(
    builder: ConfigurationBuilder<'provider>
) -> AsyncConfigurationBuilder<'provider>
[src]

Creates asynchronous builder from synchronous one, consuming it.

It should not be used directly. Instead either use async builder from the start or use one of methods of synchronous builder that convert it for you.

Exposed as public API to serve strangest needs.

pub fn add<S, D>(
    &mut self,
    source: S,
    format: D
) -> &mut AsyncConfigurationBuilder<'provider> where
    S: Source + 'provider,
    D: Format + 'provider, 
[src]

Adds new synchronous source and format to builder.

Similar to add on synchronous builder.

pub fn add_provider<P>(
    &mut self,
    provider: P
) -> &mut AsyncConfigurationBuilder<'provider> where
    P: Provider + 'provider, 
[src]

Adds new synchronous provider to builder.

Similar to add_provider on synchronous builder.

pub fn add_async<S, D>(
    &mut self,
    source: S,
    format: D
) -> &mut AsyncConfigurationBuilder<'provider> where
    S: AsyncSource + Send + Sync + 'provider,
    D: Format + Send + Sync + 'provider, 
[src]

Adds new asynchronous source and format to builder.

Similar to add_async on synchronous builder. Unlike it, however, it is not consuming the builder.

pub fn add_provider_async<P>(
    &mut self,
    provider: P
) -> &mut AsyncConfigurationBuilder<'provider> where
    P: AsyncProvider + 'provider, 
[src]

Adds new asynchronous provider to builder.

Similar to add_provider_async on synchronous builder. Unlike it, however, it is not consuming the builder.

pub async fn build(&mut self) -> Result<Configuration, ConfigurationError>[src]

Builds the builder.

This is function that actually fetches data from all the sources and deserializes them.

Since it is asynchronous, it requires runtime to be present.

Trait Implementations

impl<'provider> Default for AsyncConfigurationBuilder<'provider>[src]

Auto Trait Implementations

impl<'provider> !RefUnwindSafe for AsyncConfigurationBuilder<'provider>[src]

impl<'provider> !Send for AsyncConfigurationBuilder<'provider>[src]

impl<'provider> !Sync for AsyncConfigurationBuilder<'provider>[src]

impl<'provider> Unpin for AsyncConfigurationBuilder<'provider>[src]

impl<'provider> !UnwindSafe for AsyncConfigurationBuilder<'provider>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.