pub struct Services { /* private fields */ }Expand description
Container of engine services — concrete stateful objects with rich APIs (asset loading, serialization, telemetry, DCC orchestration).
Admission criteria. A service is registered here when it is a
concrete type with a non-trivial business API (≥ 3 methods that make
sense together), lives for the engine lifetime, and is invoked by name.
Trait implementations belong in crate::runtime::Backends. Plain
shared state belongs in crate::runtime::Resources.
API mirrors the legacy ServiceRegistry (drop-in replacement).
Implementations§
Source§impl Services
impl Services
Sourcepub fn with_parent(parent: Arc<Services>) -> Self
pub fn with_parent(parent: Arc<Services>) -> Self
Creates a container that delegates lookups to parent when a key
is absent locally. Local inserts shadow parent entries.
Sourcepub fn insert<T: Send + Sync + 'static>(&mut self, service: T)
pub fn insert<T: Send + Sync + 'static>(&mut self, service: T)
Inserts a service, keyed by T’s TypeId. Replaces any prior
entry of the same type.
Sourcepub fn get<T: Send + Sync + 'static>(&self) -> Option<&T>
pub fn get<T: Send + Sync + 'static>(&self) -> Option<&T>
Returns a borrow of the registered service, walking the parent chain on miss.
Sourcepub fn require<T: Send + Sync + 'static>(&self) -> &T
pub fn require<T: Send + Sync + 'static>(&self) -> &T
Returns a borrow of the registered service, panicking if absent.