Skip to main content

ConfigDb

Struct ConfigDb 

Source
pub struct ConfigDb;
Expand description

The configuration database. All methods are associated functions over an ambient per-test store (D11, D16).

Implementations§

Source§

impl ConfigDb

Source

pub fn set<T: Clone + Debug + 'static>( ctx: Option<&RustdvCtx>, offset: &str, field: &str, value: T, )

Store value for every component whose path matches offset (a glob), resolved against ctx.

Source

pub fn get<T: Clone + 'static>( ctx: Option<&RustdvCtx>, offset: &str, field: &str, ) -> Result<T, ConfigError>

Read field for the component at ctx + offset.

The offset must be concrete — globs are legal only when storing (D12, pyuvm’s rule). Resolution is most-specific path first, then highest precedence, then most recent write (D13).

Source

pub fn exists(ctx: Option<&RustdvCtx>, offset: &str, field: &str) -> bool

Is there a value for this field, without producing an error?

Source

pub fn set_tracing(on: bool)

Log every set and get as it happens: the context, the offset, and the path they resolved to — which is what you actually got wrong when a lookup misses. Port of pyuvm’s ConfigDB().is_tracing.

Source

pub fn is_tracing() -> bool

Source

pub fn print()

Print the whole database, including precedences. A resolved value tells you who won; this tells you who else was competing, which is what a parent/child conflict needs (D68).

Source

pub fn dump() -> String

The dump as a string, for tests and for callers that want to route it somewhere other than the log.

Source

pub fn factory_overrides() -> Vec<(String, String, String)>

The factory overrides in force, as (path, from, to) — the entries the factory stores here under a reserved key prefix (D75). Used by Factory::print.

Source

pub fn clear()

Drop every entry. The runner calls this between tests (D16), so a test never inherits another’s configuration.

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.