pub fn to_summary(&self, opts: &CargoOptions<'_>) -> Result<Summary, Error> {
        let initials = self.initials();
        let metadata =
            CargoOptionsSummary::new(initials.graph().package_graph, self.features_only(), opts)?;
        let target_features = self.target_features();
        let host_features = self.host_features();

        let mut summary = Summary::with_metadata(&metadata).map_err(Error::TomlSerializeError)?;
        summary.target_packages =
            target_features.to_package_map(initials, self.target_direct_deps());
        summary.host_packages = host_features.to_package_map(initials, self.host_direct_deps());

        Ok(summary)
    }
Creates a build summary with the given options.

Requires the `summaries` feature to be enabled.
guppy/src/graph/summaries.rs