250303 ### Rust, APIs, and the Joy of Debugging
zsh-syntax-highlighting
for improved readability.zsh-autosuggestions
for command predictions.fzf
for fuzzy searching through files and
history.autojump
for quick directory navigation.CTRL + R
to search history without
requiring fzf./usr/local/bin/brew
instead of
/opt/homebrew
.Installed Rust via rustup, ensuring the correct
environment variables were loaded.
Verified installation with:
rustc --version
cargo --version
Created a new Rust project:
cargo new skyevault-spotify
Explored Rust’s package management:
cargo add reqwest serde_json tokio
(Adding dependencies efficiently instead of manually updating
Cargo.toml
.)
reqwest
for making API requests.serde_json
for parsing Spotify’s JSON responses.reqwest
SSL certificate issues—fixed by
ensuring native-tls
was enabled.serde_json
struct definitions.During testing, we noticed that running
cargo run
every time to test code changes was painfully
slow because it was re-compiling everything from scratch. The
workaround? Use Rust’s built-in incremental compilation
features!
By default, Rust compiles the entire project before running, which is great for performance but frustrating during active debugging. The process slowed us down, especially with API calls requiring multiple iterations to troubleshoot errors.
cargo check
& cargo watch
Instead of running cargo run
for every test, we switched
to:
cargo check
– Fast Compilation Without
Runningcargo check
cargo watch
– Auto-Recompilation on File Savecargo install cargo-watch # One-time setup
cargo watch -x run
cargo run
each time.Switching to cargo check
and cargo watch
significantly reduced debugging time, making iteration
smoother while working through Spotify API issues.
"Optimized Zsh setup, installed Rust, and built first API connection for the Spotify playlist generator. Fixed incremental compilation issues."
Today, I streamlined my terminal workflow, ensuring Zsh is set up for peak efficiency. This included improving history search, adding plugins for quick navigation, and optimizing command completion. These small changes make a big difference in workflow speed.
On the development side, Rust is fully installed and
configured, and I started my first Rust-based API project: a
Spotify playlist generator. The main challenge was
handling authentication and structuring API requests in
Rust, but I got it working after some deep dives into
reqwest
and serde_json
.
During debugging, I realized Rust’s full recompilation process was
slowing things down. Implementing cargo check
for
faster error-checking and
cargo watch -x run
for automatic
recompilation made a huge difference in workflow speed.
Troubleshooting highlights:
- Adjusted Rust structs to properly handle JSON responses.
- Resolved SSL issues in reqwest
.
- Fixed empty API responses by refining request parameters.
- Improved debugging efficiency by reducing unnecessary full
rebuilds.
Current Roadblock:
- Final API response handling is throwing errors.
- Still working on refining how the data is structured before
rendering.
Overall, a solid foundation is now in place for both Rust development and DevOps workflow.
Rust is proving to be a powerful but meticulous language. Learning how to streamline debugging and reduce compilation time made a huge difference today. The Spotify API project is taking shape, and even though there’s still an error in the final response parsing, the overall progress has been solid. Excited to solve the last issue and move forward with cleaner, more efficient Rust workflows!