Returns the [`InstancePre`] that was used to create this instance.
(&self, store: impl AsContext<Data = T>)
| 357 | |
| 358 | /// Returns the [`InstancePre`] that was used to create this instance. |
| 359 | pub fn instance_pre<T>(&self, store: impl AsContext<Data = T>) -> InstancePre<T> { |
| 360 | // This indexing operation asserts the Store owns the Instance. |
| 361 | // Therefore, the InstancePre<T> must match the Store<T>. |
| 362 | let data = self.id().get(store.as_context().0); |
| 363 | |
| 364 | // SAFETY: calling this method safely here relies on matching the `T` |
| 365 | // in `InstancePre<T>` to the store itself, which is happening in the |
| 366 | // type signature just above by ensuring the store's data is `T` which |
| 367 | // matches the return value. |
| 368 | unsafe { data.instance_pre() } |
| 369 | } |
| 370 | |
| 371 | pub(crate) fn id(&self) -> StoreComponentInstanceId { |
| 372 | self.id |
nothing calls this directly
no test coverage detected