Coloring of output and analysis of dependencies

⚓ Rust    📅 2025-08-21    👤 surdeus    👁️ 3      

surdeus

I am writing a small personal CLI in Rust. There are two not so important issues I'd need help with:

  1. Is there any built in way to analyse the how much a dependency contributes to the build time?
    For the depsize (may be a bad metric) there isn't a cargo built-in tool for it (cargo tree doesn't seem to do this).
    I've only found cargo-depsize, which does seem neat. I do think one could also use the cargo cache instead of http-querying metadata (which must be slower).
    My goal is that my little tool compiles in a short time, and uses dependencies that contain not too much extra functionality (although I know I should learn to use the features flag as well.)
  2. Is there a way to colour the cargo outputs that go through less or more, or do i need another tool?
    For example, this fails:
    cargo report --color always --help | less # or more etc.
    
    I tried some less flags like -R, but no luck so far, and I want to conserve the way cargo displays it.

PS: it seems for 1. cargo +nightly build --timings may be useful.

3 posts - 3 participants

Read full topic

🏷️ Rust_feed