Skip to main content

Configuration

Trait Configuration 

Source
pub trait Configuration:
    Default
    + Send
    + Sync
    + Debug
    + 'static {
    const NAME: &'static str;

    // Required methods
    fn ctx(&self) -> &CfgContext;
    fn set_ctx(&mut self, ctx: CfgContext);
}
Expand description

A value that can be stored in SharedCfg.

Default supplies the value returned when a shared configuration does not contain this type; see SharedCfg::get. Each thread creates its own default, so it should be deterministic and must not stand in for a value the application is required to provide.

Required Associated Constants§

Source

const NAME: &'static str

Human-readable configuration name used in diagnostics.

Required Methods§

Source

fn ctx(&self) -> &CfgContext

Returns the shared context associated with this value.

Source

fn set_ctx(&mut self, ctx: CfgContext)

Associates this value with a shared configuration context.

SharedCfgBuilder::add calls this before the configuration is built, so CfgContext::get and CfgContext::shared panic here; store the context and use it later.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§