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
impl ResolvedOptions
Sourcepub fn new() -> Self
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.
Sourcepub fn get<T: OptionDecl>(&self) -> Option<Arc<T::Value>>
pub fn get<T: OptionDecl>(&self) -> Option<Arc<T::Value>>
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).
Sourcepub fn insert<T: OptionDecl>(&mut self, value: T::Value)
pub fn insert<T: OptionDecl>(&mut self, value: T::Value)
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).
Sourcepub fn get_origin<T: OptionDecl>(&self) -> OptionOrigin
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).
Sourcepub fn get_origin_for_typeid(&self, type_id: TypeId) -> OptionOrigin
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).
Sourcepub fn get_erased(&self, type_id: TypeId) -> Option<&Arc<dyn Any + Send + Sync>>
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.
Trait Implementations§
Source§impl Clone for ResolvedOptions
impl Clone for ResolvedOptions
Source§fn clone(&self) -> ResolvedOptions
fn clone(&self) -> ResolvedOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more