Skip to main content

FromConfig

Trait FromConfig 

Source
pub trait FromConfig<TConfig>
where Self: Sized,
{ // Required method fn from_config<'life0, 'async_trait>( config: &'life0 TConfig, ) -> Pin<Box<dyn Future<Output = Result<Self, Box<dyn Error>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; }
Expand description

Asynchronously constructs an instance of Self from a configuration type.

This trait provides a generic mechanism for initializing structs from their corresponding configuration types. It is used throughout the x402-rs crate to build providers, registries, and other components from configuration files.

§Type Parameters

  • TConfig - The configuration type that Self can be constructed from

Return an error if:

  • Configuration validation fails
  • Required external connections (RPC, etc.) cannot be established
  • Configuration values are invalid or missing

Required Methods§

Source

fn from_config<'life0, 'async_trait>( config: &'life0 TConfig, ) -> Pin<Box<dyn Future<Output = Result<Self, Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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.

Implementors§