pub struct WrapperRegistry { /* private fields */ }Expand description
Live view over every registered wrapper. Built once at
startup from the inventory collection.
The struct is cheap to clone (it borrows the static
registrations) and is passed to the crate::wrapper_resolver::WrapperResolver
for per-op-template plan computation.
Implementations§
Source§impl WrapperRegistry
impl WrapperRegistry
Sourcepub fn from_inventory() -> Self
pub fn from_inventory() -> Self
Build the registry from every inventory::submit!
entry currently linked into the binary. Invoked once
at startup.
Sourcepub fn iter(&self) -> impl Iterator<Item = &'static WrapperRegistration> + '_
pub fn iter(&self) -> impl Iterator<Item = &'static WrapperRegistration> + '_
Iterate every registered wrapper.
Sourcepub fn owns_field(&self, field: &str) -> bool
pub fn owns_field(&self, field: &str) -> bool
Whether field is an op-template key declared as owned by ANY
registered wrapper (its trigger or a knob it consumes). This is
the single structural source of truth for “this params key is a
wrapper field” — driven by each wrapper’s owned_fields
declaration, not a hand-maintained parallel list. The op
closed-vocabulary guard consults it so a wrapper field is
accepted because a wrapper declares it, not because it happens
to also be a CLI param (SRD-32a). Adding a wrapper therefore
never requires touching CORE_OP_PARAMS or the CLI vocabulary.
Sourcepub fn all_owned_fields(&self) -> BTreeSet<&'static str>
pub fn all_owned_fields(&self) -> BTreeSet<&'static str>
Every field name owned by some registered wrapper, deduplicated. Exposed for diagnostics (the closed-vocab guard names the full accepted wrapper vocabulary) and for the drift-guard test.
Sourcepub fn get(&self, name: WrapperName) -> Option<&'static WrapperRegistration>
pub fn get(&self, name: WrapperName) -> Option<&'static WrapperRegistration>
Look up by name. Returns None for unknown names; the
caller surfaces that as a typo diagnostic with a
closest-match suggestion (see closest_match).
Sourcepub fn get_str(&self, name: &str) -> Option<&'static WrapperRegistration>
pub fn get_str(&self, name: &str) -> Option<&'static WrapperRegistration>
Look up by raw string. Convenience for parsing the
--wrap-default-order / wrappers.order lists.
pub fn is_empty(&self) -> bool
Sourcepub fn closest_match(&self, query: &str) -> Option<&'static str>
pub fn closest_match(&self, query: &str) -> Option<&'static str>
Find the registered wrapper name closest to query by
Levenshtein distance. Used for “did you mean … ?”
diagnostics on unknown names.
Sourcepub fn misplaced_fields(
&self,
subject: WrapperSubject<'_>,
) -> Vec<(WrapperName, &'static str)>
pub fn misplaced_fields( &self, subject: WrapperSubject<'_>, ) -> Vec<(WrapperName, &'static str)>
SRD-32a Push 2 — find every owned field that’s present on the op template but whose owning wrapper does NOT trigger. Returns one (wrapper, field) pair per violation; an empty vec means every field is in its proper place.
field_present_on_template is the predicate the
caller uses to ask “is field X set on this op?” — it
abstracts the fact that some wrapper-owned fields
(e.g. if, delay) live outside params:. In
practice the owned fields that AREN’T also their
wrapper’s trigger always live under params:, so a
caller can pass a closure over template.params .contains_key.
Auto Trait Implementations§
impl Freeze for WrapperRegistry
impl RefUnwindSafe for WrapperRegistry
impl Send for WrapperRegistry
impl Sync for WrapperRegistry
impl Unpin for WrapperRegistry
impl UnsafeUnpin for WrapperRegistry
impl UnwindSafe for WrapperRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more