fn entity_finished(&self, entity: &EntityId) -> Result<(), Error> {
        match entity {
            EntityId::TestRun => self.persist_run_summary(),
            EntityId::Suite(suite_id) => {
                let mut entries = self.entries.lock();
                let suite_entry = entries
                    .remove(entity)
                    .expect("Suite entry not found, was it already recorded?");
                let case_entries = suite_entry
                    .children
                    .iter()
                    .map(|case_id| {
                        entries.remove(case_id).expect("Test case referenced by suite not found")
                    })
                    .collect();
                let serializable_suite = construct_serializable_suite(suite_entry, case_entries);
                let summary_path = self.root.join(suite_json_name(suite_id.0));
                let mut summary = File::create(summary_path)?;
                serde_json::to_writer_pretty(&mut summary, &serializable_suite)?;
                summary.sync_all()?;
                drop(entries); // drop lock
                self.persist_run_summary()
            }
            // Cases are saved as part of suites.
            EntityId::Case { .. } => Ok(()),
        }
    }
/// Finalize and persist the outcome and artifacts for an entity. This should only be
/// called once per entity.
Finalize and persist the outcome and artifacts for an entity. This should only be
called once per entity.
Finalize and persist the outcome and artifacts for an entity . This should only be called once per entity .
fn entity_finished(&self, entity: &EntityId) -> Result<(), Error> {
        match entity {
            EntityId::TestRun => self.persist_run_summary(),
            EntityId::Suite(suite_id) => {
                let mut entries = self.entries.lock();
                let suite_entry = entries
                    .remove(entity)
                    .expect("Suite entry not found, was it already recorded?");
                let case_entries = suite_entry
                    .children
                    .iter()
                    .map(|case_id| {
                        entries.remove(case_id).expect("Test case referenced by suite not found")
                    })
                    .collect();
                let serializable_suite = construct_serializable_suite(suite_entry, case_entries);
                let summary_path = self.root.join(suite_json_name(suite_id.0));
                let mut summary = File::create(summary_path)?;
                serde_json::to_writer_pretty(&mut summary, &serializable_suite)?;
                summary.sync_all()?;
                drop(entries); // drop lock
                self.persist_run_summary()
            }
            // Cases are saved as part of suites.
            EntityId::Case { .. } => Ok(()),
        }
    }
fn entity_finished ( & self , entity : & EntityId ) -> Result < ( ) , Error > { match entity { EntityId :: TestRun => self . persist_run_summary ( ) , EntityId :: Suite ( suite_id ) => { let mut entries = self . entries . lock ( ) ; let suite_entry = entries . remove ( entity ) . expect ( " " ) ; let case_entries = suite_entry . children . iter ( ) . map ( | case_id | { entries . remove ( case_id ) . expect ( " " ) } ) . collect ( ) ; let serializable_suite = construct_serializable_suite ( suite_entry , case_entries ) ; let summary_path = self . root . join ( suite_json_name ( suite_id . 0 ) ) ; let mut summary = File :: create ( summary_path ) ? ; serde_json :: to_writer_pretty ( & mut summary , & serializable_suite ) ? ; summary . sync_all ( ) ? ; drop ( entries ) ; // drop lock self . persist_run_summary ( ) } // Cases are saved as part of suites. EntityId :: Case { .. } => Ok ( ( ) ) , } }
Finalize and persist the outcome and artifacts for an entity.
Finalize and persist the outcome and artifacts for an entity .
&self
entity
&EntityId
&self
entity
&EntityId