pub async fn destroy_instance(model: Arc<Model>, realm: Arc<Realm>) -> Result<(), ModelError> {
        // Clean up isolated storage.
        let decl = {
            let state = realm.lock_state().await;
            if let Some(state) = state.as_ref() {
                state.decl.clone()
            } else {
                // The instance was never resolved and therefore never ran, it can't possibly have
                // storage to clean up.
                return Ok(());
            }
        };
        for use_ in decl.uses.iter() {
            if let UseDecl::Storage(use_storage) = use_ {
                routing::route_and_delete_storage(&model, &use_storage, realm.abs_moniker.clone())
                    .await?;
                break;
            }
        }
        Ok(())
    }
/// Destroys this component instance.
/// REQUIRES: All children have already been destroyed.
// TODO: Need to:
// - Delete the instance's persistent marker, if it was a persistent dynamic instance
Destroys this component instance.
REQUIRES: All children have already been destroyed.
TODO: Need to:
Delete the instance's persistent marker, if it was a persistent dynamic instance
Destroys this component instance . REQUIRES : All children have already been destroyed . TODO : Need to : Delete the instance ' s persistent marker if it was a persistent dynamic instance
pub async fn destroy_instance(model: Arc<Model>, realm: Arc<Realm>) -> Result<(), ModelError> {
        // Clean up isolated storage.
        let decl = {
            let state = realm.lock_state().await;
            if let Some(state) = state.as_ref() {
                state.decl.clone()
            } else {
                // The instance was never resolved and therefore never ran, it can't possibly have
                // storage to clean up.
                return Ok(());
            }
        };
        for use_ in decl.uses.iter() {
            if let UseDecl::Storage(use_storage) = use_ {
                routing::route_and_delete_storage(&model, &use_storage, realm.abs_moniker.clone())
                    .await?;
                break;
            }
        }
        Ok(())
    }
pub async fn destroy_instance ( model : Arc < Model > , realm : Arc < Realm > ) -> Result < ( ) , ModelError > { // Clean up isolated storage. let decl = { let state = realm . lock_state ( ) . await ; if let Some ( state ) = state . as_ref ( ) { state . decl . clone ( ) } else { // The instance was never resolved and therefore never ran, it can't possibly have // storage to clean up. return Ok ( ( ) ) ; } } ; for use_ in decl . uses . iter ( ) { if let UseDecl :: Storage ( use_storage ) = use_ { routing :: route_and_delete_storage ( & model , & use_storage , realm . abs_moniker . clone ( ) ) . await ? ; break ; } } Ok ( ( ) ) }
Destroys this component instance.
Destroys this component instance .
model
Arc<Model>
realm
Arc<Realm>