Why I built cargo-feat: A 10ms solution to feature lookup friction

Sascha

Команда форума
Администратор
Ofline

The Problem​


Every time I add a dependency to Cargo.toml, I need to know what features
it exposes. Current workflow:

  1. Open browser
  2. Search crates.io or docs.rs
  3. Scroll through documentation
  4. Find the feature list
  5. Close browser

Repeat 20 times a day. Annoying.

Existing tools like cargo info exist but are slow (80ms+).

The Solution​


Built cargo-feat. Single command. Shows every feature, marks defaults,
lists what each feature pulls in.


Код:
$ feat reqwest

— reqwest's features are in the following list —
    ★ default
         default-tls
         charset
         http2
         system-proxy

    — blocking
    — brotli
    — charset          (default)
    ...



Done in 9.9ms.

Why It's Fast​


Three optimizations:


  1. Sparse registry index — reads crates.io sparse index directly
    (via Cloudflare CDN). Cargo uses same source. Faster than REST API.


  2. Local cache first — checks ~/.cargo/registry/index/ before network.
    If you've ever built with this crate, result is instant.
    After network fetch, written to cache. Next run: always fast.


  3. Early-stop parsing — scans index from end, stops at first stable
    version. O(1) entries instead of O(n versions).

Also uses MiMalloc + simd-json for JSON parsing.

Benchmarks​


(Include table from README or simple comparison)


Код:
cargo feat reqwest        9.9 ms
cargo info reqwest       92.7 ms  (9.4x slower)



Works same speed for serde (180+ versions). Lookup time flat
regardless of version count.

Installation​


Код:
cargo install cargo-feat



Then use it:


Код:
feat reqwest              # latest version
feat tokio 1.35.0         # specific version
feat reqwest --deps       # show dependencies
feat reqwest --internals  # show internal features
feat serde --json         # raw JSON output


Try It​

Fast CLI tool for Rust that instantly lists a crate’s features from crates.io without opening a browser. Shows default features, dependencies, and metadata with minimal overhead and optimized lookup performance. Built for speed-focused workflows.​


crates.io

A fast command-line tool for Rust developers to instantly look up the available features of any crate on crates.io - directly in your terminal, with no browser required.



When adding a dependency, finding out what features it exposes usually means opening a browser, searching crates.io or docs.rs, and scrolling through documentation. cargo-feat removes that friction: one command gives you a color-coded list of every feature the crate exposes, which ones are enabled by default, and what each feature pulls in.



Код:
$ feat reqwest

— reqwest's features are in the following list —
    ★ default
         default-tls
         charset
         http2
         system-proxy

    — blocking
    — brotli
    — charset          (default)
    — cookies
    — default-tls      (default)
    — deflate
    — gzip
    — http2            (default)
    — ...

Installation​

From crates.io​


cargo install cargo-feat


From source​


Requires a recent stable Rust toolchain.


git clone GitHub - vunholy/cargo-feat: Fast CLI tool for Rust that instantly lists a crate’s features from crates.io without opening a browser. Shows default features, dependencies, and metadata with minimal overhead and optimized lookup performance. Built for speed-focused workflows. https://github.com/vunholy/cargo-feat.git
cd cargo-feat
cargo build --release



The compiled binary will be…


Open to feedback. Built this to scratch personal itch,
figured others had same problem.

If you found it interesting, please do star it makes my day 😀

 
Назад
Сверху Снизу