pub async fn build(db: chartered_db::ConnectionPool, user_id: i32, org_name: String) -> Self {
        let mut crates = BTreeMap::new();

        for (crate_def, versions) in Crate::list_with_versions(db, user_id, org_name)
            .await
            .unwrap()
        {
            // the manifest we'll be returning to the user
            let mut file = String::new();

            // loop over all versions for the crate, serialising each version to json
            // and writing them to the manifest split by newline.
            for version in versions {
                let cksum = version.checksum.clone();
                let yanked = version.yanked;
                let version = version.into_cargo_format(&crate_def);

                let entry = CrateFileEntry {
                    inner: &version,
                    cksum: &cksum,
                    yanked,
                };

                file.push_str(&serde_json::to_string(&entry).unwrap());
                file.push('\n');
            }

            // insert the crate into `self.crates`
            crates.insert(crate_def.name, file);
        }

        Self { crates }
    }
/// Grabs all the crates that the user has access to and writes out the manifests to
/// `self.crates`.
Grabs all the crates that the user has access to and writes out the manifests to
`self.crates`.
Grabs all the crates that the user has access to and writes out the manifests to ` self . crates ` .
pub async fn build(db: chartered_db::ConnectionPool, user_id: i32, org_name: String) -> Self {
        let mut crates = BTreeMap::new();
        for (crate_def, versions) in Crate::list_with_versions(db, user_id, org_name)
            .await
            .unwrap()
        {
            // the manifest we'll be returning to the user
            let mut file = String::new();
            // loop over all versions for the crate, serialising each version to json
            // and writing them to the manifest split by newline.
            for version in versions {
                let cksum = version.checksum.clone();
                let yanked = version.yanked;
                let version = version.into_cargo_format(&crate_def);
                let entry = CrateFileEntry {
                    inner: &version,
                    cksum: &cksum,
                    yanked,
                };
                file.push_str(&serde_json::to_string(&entry).unwrap());
                file.push('\n');
            }
            // insert the crate into `self.crates`
            crates.insert(crate_def.name, file);
        }
        Self { crates }
    }
pub async fn build ( db : chartered_db :: ConnectionPool , user_id : i32 , org_name : String ) -> Self { let mut crates = BTreeMap :: new ( ) ; for ( crate_def , versions ) in Crate :: list_with_versions ( db , user_id , org_name ) . await . unwrap ( ) { // the manifest we'll be returning to the user let mut file = String :: new ( ) ; // loop over all versions for the crate, serialising each version to json // and writing them to the manifest split by newline. for version in versions { let cksum = version . checksum . clone ( ) ; let yanked = version . yanked ; let version = version . into_cargo_format ( & crate_def ) ; let entry = CrateFileEntry { inner : & version , cksum : & cksum , yanked , } ; file . push_str ( & serde_json :: to_string ( & entry ) . unwrap ( ) ) ; file . push ( '\n' ) ; } // insert the crate into `self.crates` crates . insert ( crate_def . name , file ) ; } Self { crates } }
Grabs all the crates that the user has access to and writes out the manifests to
`self.crates`.
Grabs all the crates that the user has access to and writes out the manifests to ` self . crates ` .
db
chartered_db::ConnectionPool
user_id
i32
org_name
String
db
chartered_db::ConnectionPool
user_id
i32
org_name
String