Rust cli example #2: Ferris hunts errors

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • gophers

    Gopher artwork (Golang mascot) (by scraly)

  • fn get_gopher(gopher: String) -> Result { println!("Try to get {} Gopher...", gopher); let url = format!("https://github.com/scraly/gophers/raw/main/{}.png", gopher); let response = minreq::get(url) .send() .expect("Fail to get response from server"); if response.status_code == 200 { let file_name = format!("{}.png", gopher); let mut output_file = File::create(&file_name).expect("Fail to create file"); output_file .write_all(response.as_bytes()) .expect("Fail to write file"); Ok(format!("Perfect! Just saved in {}", &file_name)) } else { Err(Error::GopherNotFound(format!( "Gopher {} not exists", gopher ))) } }

  • log

    Logging implementation for Rust (by rust-lang)

  • A logging facade provides a single logging API that abstracts over the actual logging implementation. Libraries can use the logging API provided by this crate, and the consumer of those libraries can choose the logging implementation that is most suitable for its use case. Sources

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • rust-simple_logger

    A rust logger that prints all messages with a readable output format.

  • As a backend facility, we will use the simple_logger crate. This crate will simply output messages formatted like this 2015-02-24 01:05:20 WARN [logging_example] This is an example message. I like the crate because it is simple to use and a good fit for small projects. Also, I contributed to another project (rust-riemann-client) maintained by the same author @borntyping (hello Sam) and, it was really an excellent experience. Sources

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts