Summary
In this chapter, we learned to write Rust programs that can discover and manipulate the system environment, directory structures, and filesystem metadata in a cross-platform manner, using the std::env
, std::path
, and std::fs
modules. We looked at how to create programs that can use command-line arguments or environment variables to accept configuration parameters and user inputs. We saw the use of two third-party crates: the StructOpt
crate to improve the user interface of the tool, and image-rs/image
to do the image resizing.
We also learned how to use the std:time
module to measure the time taken for specific processing tasks. We defined a custom error type to unify error handling in the library. In this chapter, we were also introduced to file handling operations.
In the next chapter, we will take a detailed look at doing advanced memory management with the standard library.