ACP Wrap up

This commit is contained in:
2026-08-05 08:10:41 -05:00
parent 2015498831
commit 993abb96df
23 changed files with 1459 additions and 1194 deletions
+11
View File
@@ -4909,6 +4909,17 @@ impl GetSingletonModelHandle for AppContext {
}
impl AppContext {
/// Returns a singleton model when it has already been registered.
///
/// This is useful for infrastructure models that can also be constructed
/// in isolation by tests before the full application singleton graph is
/// available.
pub fn try_get_singleton_model_as_ref<T: SingletonEntity>(&self) -> Option<&T> {
self.singleton_models
.get(&std::any::TypeId::of::<T>())?
.downcast_ref(self)
}
pub(super) fn get_singleton_model_as_ref<T: SingletonEntity>(&self) -> &T {
match self.singleton_models.get(&std::any::TypeId::of::<T>()) {
Some(model_handle) => model_handle