pub struct ComponentsView<'a> {
pub instances: Option<&'a [Option<Box<dyn ErasedComponent>>]>,
pub slots: Option<&'a HashMap<String, ComponentRef>>,
}Expand description
Read-only view onto sibling components registered on the Node.
Constructed by the engine at dispatch time from
&engine.components + &engine.slots. The Vec is indexed by
ComponentRef.as_u32() as usize; the slot the currently-
dispatching component lives in is None for the duration of
the dispatch (take-and-restore in invoke_atomic), so callers
can’t accidentally re-enter themselves.
Fields§
§instances: Option<&'a [Option<Box<dyn ErasedComponent>>]>All registered components indexed by ComponentRef.as_u32(),
borrowed from engine.components. None outside engine
context (test setups bypassing the registry).
slots: Option<&'a HashMap<String, ComponentRef>>Author-chosen-slot-name → ComponentRef map, borrowed from
engine.slots. THE canonical dependency-resolution surface.
None outside engine context.
Implementations§
Source§impl ComponentsView<'_>
impl ComponentsView<'_>
Sourcepub fn for_slot(&self, slot_name: &str) -> Option<&dyn ErasedComponent>
pub fn for_slot(&self, slot_name: &str) -> Option<&dyn ErasedComponent>
Look up the component bound at slot_name. The generic
dependency-resolution surface — Components reach their
declared dependencies through this accessor. Returns None
when no slot of that name is bound or when the view has no
engine context.
Sourcepub fn for_slot_as<T: 'static>(&self, slot_name: &str) -> Option<&T>
pub fn for_slot_as<T: 'static>(&self, slot_name: &str) -> Option<&T>
Look up the component bound at slot_name AND downcast it
to &T. The typed counterpart to Self::for_slot.
Returns None when the slot is unbound OR when the bound
concrete is not a T.
In production this is reached through
crate::runtime::RuntimeResourceRef::dependency, which
wraps the lookup in DependencyError variants for typed
error reporting.
Trait Implementations§
Source§impl<'a> Default for ComponentsView<'a>
impl<'a> Default for ComponentsView<'a>
Source§fn default() -> ComponentsView<'a>
fn default() -> ComponentsView<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ComponentsView<'a>
impl<'a> !UnwindSafe for ComponentsView<'a>
impl<'a> Freeze for ComponentsView<'a>
impl<'a> Send for ComponentsView<'a>
impl<'a> Sync for ComponentsView<'a>
impl<'a> Unpin for ComponentsView<'a>
impl<'a> UnsafeUnpin for ComponentsView<'a>
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
impl<T> ErasedComponent for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request