Skip to main content

ResolvedOptions

Struct ResolvedOptions 

Source
pub struct ResolvedOptions { /* private fields */ }
Expand description

Cached snapshot of the resolved value for every option a buffer reads. Built by the crate::Resolver; invalidated on mode toggle, option write, or modal-state transition; recomputed eagerly on invalidation per the v1 invalidation policy (mode-architecture.md §6.3.1).

Public read API: Self::get (typed), Self::get_origin (layer that supplied the value). The internal storage is pub(crate) so the resolver in this crate can populate it; external code reads through the typed accessors.

Implementations§

Source§

impl ResolvedOptions

Source

pub fn new() -> Self

An empty cache. Every Self::get returns None until it is seeded (typically by crate::ConfigRegistry::bootstrap_resolved_with_current_values) and overlaid by a crate::Resolver.

Source

pub fn get<T: OptionDecl>(&self) -> Option<Arc<T::Value>>
where T::Value: Send + Sync + 'static,

Read the resolved value for option type T. Returns None if T was not part of this resolution cycle (e.g. the option isn’t registered, or the resolver hasn’t run yet).

Source

pub fn insert<T: OptionDecl>(&mut self, value: T::Value)
where T::Value: Send + Sync + 'static,

Test helper: insert a resolved value directly. Used by tests across crates that exercise the read path without running the resolver. Production code fills the cache through the crate::Resolver and crate::ConfigRegistry::bootstrap_resolved_with_current_values, which also record an OptionOrigin; this does not, so the entry’s origin stays whatever it was (default: OptionOrigin::Default).

Source

pub fn get_origin<T: OptionDecl>(&self) -> OptionOrigin

Look up the origin for option type T. Returns OptionOrigin::Default if the option wasn’t resolved in this cycle (unknown option / resolver hasn’t run yet).

Source

pub fn get_origin_for_typeid(&self, type_id: TypeId) -> OptionOrigin

TypeId-keyed origin lookup for sites that only have a runtime TypeId (e.g. the query echo path in do_set).

Source

pub fn get_erased(&self, type_id: TypeId) -> Option<&Arc<dyn Any + Send + Sync>>

TypeId-keyed erased value lookup. Used by the query echo path to format the resolved value when the concrete type isn’t statically known.

Source

pub fn len(&self) -> usize

Number of entries (for tests and :describe-buffer / introspection diagnostic output).

Source

pub fn is_empty(&self) -> bool

true when no option has been resolved into the cache.

Source

pub fn iter( &self, ) -> impl Iterator<Item = (&TypeId, &Arc<dyn Any + Send + Sync>)>

Iterate over (TypeId, erased Arc) pairs. Used by :describe-option-resolution (M.8) and tests.

Trait Implementations§

Source§

impl Clone for ResolvedOptions

Source§

fn clone(&self) -> ResolvedOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResolvedOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ResolvedOptions

Source§

fn default() -> ResolvedOptions

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more