async fn destroy_transient_children(
        model: Arc<Model>,
        realm: Arc<Realm>,
        state: &mut RealmState,
    ) -> Result<Vec<Notification>, ModelError> {
        let transient_colls: HashSet<_> = state
            .decl()
            .collections
            .iter()
            .filter_map(|c| match c.durability {
                fsys::Durability::Transient => Some(c.name.clone()),
                fsys::Durability::Persistent => None,
            })
            .collect();
        let mut futures = vec![];
        let child_monikers: Vec<_> = state.all_child_realms().keys().map(|m| m.clone()).collect();
        for m in child_monikers {
            // Delete a child if its collection is in the set of transient collections created
            // above.
            if let Some(coll) = m.collection() {
                if transient_colls.contains(coll) {
                    let partial_moniker = m.to_partial();
                    state.mark_child_realm_deleting(&partial_moniker);
                    let nf =
                        Self::register_action(realm.clone(), model.clone(), Action::DeleteChild(m))
                            .await;
                    futures.push(nf);
                }
            }
        }
        Ok(futures)
    }
/// Registers actions to destroy all children of `realm` that live in transient collections.
/// Returns a future that completes when all those children are destroyed.
Registers actions to destroy all children of `realm` that live in transient collections.
Returns a future that completes when all those children are destroyed.
Registers actions to destroy all children of ` realm ` that live in transient collections . Returns a future that completes when all those children are destroyed .
async fn destroy_transient_children(
        model: Arc<Model>,
        realm: Arc<Realm>,
        state: &mut RealmState,
    ) -> Result<Vec<Notification>, ModelError> {
        let transient_colls: HashSet<_> = state
            .decl()
            .collections
            .iter()
            .filter_map(|c| match c.durability {
                fsys::Durability::Transient => Some(c.name.clone()),
                fsys::Durability::Persistent => None,
            })
            .collect();
        let mut futures = vec![];
        let child_monikers: Vec<_> = state.all_child_realms().keys().map(|m| m.clone()).collect();
        for m in child_monikers {
            // Delete a child if its collection is in the set of transient collections created
            // above.
            if let Some(coll) = m.collection() {
                if transient_colls.contains(coll) {
                    let partial_moniker = m.to_partial();
                    state.mark_child_realm_deleting(&partial_moniker);
                    let nf =
                        Self::register_action(realm.clone(), model.clone(), Action::DeleteChild(m))
                            .await;
                    futures.push(nf);
                }
            }
        }
        Ok(futures)
    }
async fn destroy_transient_children ( model : Arc < Model > , realm : Arc < Realm > , state : & mut RealmState , ) -> Result < Vec < Notification > , ModelError > { let transient_colls : HashSet < _ > = state . decl ( ) . collections . iter ( ) . filter_map ( | c | match c . durability { fsys :: Durability :: Transient => Some ( c . name . clone ( ) ) , fsys :: Durability :: Persistent => None , } ) . collect ( ) ; let mut futures = vec ! [ ] ; let child_monikers : Vec < _ > = state . all_child_realms ( ) . keys ( ) . map ( | m | m . clone ( ) ) . collect ( ) ; for m in child_monikers { // Delete a child if its collection is in the set of transient collections created // above. if let Some ( coll ) = m . collection ( ) { if transient_colls . contains ( coll ) { let partial_moniker = m . to_partial ( ) ; state . mark_child_realm_deleting ( & partial_moniker ) ; let nf = Self :: register_action ( realm . clone ( ) , model . clone ( ) , Action :: DeleteChild ( m ) ) . await ; futures . push ( nf ) ; } } } Ok ( futures ) }
Registers actions to destroy all children of `realm` that live in transient collections.
Registers actions to destroy all children of ` realm ` that live in transient collections .
model
Arc<Model>
realm
Arc<Realm>
state
&mut RealmState