theduke / crates-io-api

API client for crates.io, the Rust crate registry.
Apache License 2.0
72 stars 26 forks source link

Get count of total dependents faster #31

Closed nasifimtiazohi closed 2 years ago

nasifimtiazohi commented 3 years ago

Use case: get the total dependent count for a given crate.

Current approach: crate_reverse_dependencies loops through all pages in reverse_dependencies to fetch all the dependents and then we can extract the total count from meta field.

Suggested approach: A separate function total_dependent_count where we can fetch the meta field just from the page 1 from crates.io API and return the result to the user. Will be faster is user only wants the total count.