fn increment_download_counts(
    req: &dyn Request,
    crate_name: &str,
    version: &str,
) -> AppResult<String> {
    use self::versions::dsl::*;

    let conn = req.db_conn()?;
    let (version_id, crate_name) = versions
        .inner_join(crates::table)
        .select((id, crates::name))
        .filter(Crate::with_name(crate_name))
        .filter(num.eq(version))
        .first(&*conn)?;

    // Wrap in a transaction so we don't poison the outer transaction if this
    // fails
    let _ = conn.transaction(|| VersionDownload::create_or_increment(version_id, &conn));
    Ok(crate_name)
}
/// Increment the download counts for a given crate version.
///
/// Returns the crate name as stored in the database, or an error if we could
/// not load the version ID from the database.
///
/// This ignores any errors that occur updating the download count. Failure is
/// expected if the application is in read only mode, or for API-only mirrors.
/// Even if failure occurs for unexpected reasons, we would rather have `cargo
/// build` succeed and not count the download than break people's builds.
Increment the download counts for a given crate version.
Returns the crate name as stored in the database, or an error if we could
not load the version ID from the database.

This ignores any errors that occur updating the download count. Failure is
expected if the application is in read only mode, or for API-only mirrors.
Even if failure occurs for unexpected reasons, we would rather have `cargo
build` succeed and not count the download than break people's builds.
Increment the download counts for a given crate version . Returns the crate name as stored in the database or an error if we could not load the version ID from the database . This ignores any errors that occur updating the download count . Failure is expected if the application is in read only mode or for API - only mirrors . Even if failure occurs for unexpected reasons we would rather have ` cargo build ` succeed and not count the download than break people ' s builds .
fn increment_download_counts(
    req: &dyn Request,
    crate_name: &str,
    version: &str,
) -> AppResult<String> {
    use self::versions::dsl::*;
    let conn = req.db_conn()?;
    let (version_id, crate_name) = versions
        .inner_join(crates::table)
        .select((id, crates::name))
        .filter(Crate::with_name(crate_name))
        .filter(num.eq(version))
        .first(&*conn)?;
    // Wrap in a transaction so we don't poison the outer transaction if this
    // fails
    let _ = conn.transaction(|| VersionDownload::create_or_increment(version_id, &conn));
    Ok(crate_name)
}
fn increment_download_counts ( req : & dyn Request , crate_name : & str , version : & str , ) -> AppResult < String > { use self :: versions :: dsl :: * ; let conn = req . db_conn ( ) ? ; let ( version_id , crate_name ) = versions . inner_join ( crates :: table ) . select ( ( id , crates :: name ) ) . filter ( Crate :: with_name ( crate_name ) ) . filter ( num . eq ( version ) ) . first ( & * conn ) ? ; // Wrap in a transaction so we don't poison the outer transaction if this // fails let _ = conn . transaction ( | | VersionDownload :: create_or_increment ( version_id , & conn ) ) ; Ok ( crate_name ) }
Increment the download counts for a given crate version.
Increment the download counts for a given crate version .
req
&dyn Request
crate_name
&str
version
&str