This is the 11th in a series of videos that cover, step by step, learning to code using the Rust programming language.
In this video we'll introduce real-world interfaces and error-handling, such as:
Environment variables
Command-line arguments
Standard input/output
Reading and writing files
Sending and receiving network packets
Representing and dealing with errors
Standard Rust library modules we talk about:
std::env - https://doc.rust-lang.org/std/env
std::io - https://doc.rust-lang.org/std/io
std::net - https://doc.rust-lang.org/std/net
std::fs - https://doc.rust-lang.org/std/fs
Other crates mentioned:
structopt - https://lib.rs/crates/structopt
clap - https://lib.rs/crates/clap
log - https://lib.rs/crates/log
simple_logger - https://lib.rs/crates/simple_logger
simplelog - https://lib.rs/crates/simplelog
hyper - https://lib.rs/crates/hyper
reqwest - https://lib.rs/crates/reqwest
tiny_http - https://lib.rs/crates/tiny_http
thiserror - https://lib.rs/crates/thiserror
anyhow - https://lib.rs/crates/anyhow
0:00 - Introduction
0:36 - Environment variables
2:20 - Different string types: String, PathBuf, OsString, etc.
3:39 - Command Line Arguments
6:12 - Standard Input and Output
7:21 - Writing directly to standard output
8:37 - Reading from standard input
10:00 - Reading and writing files
12:40 - writeln! macro
13:19 - Sending and receiving packets over the network
18:24 - Error handling: unwrap and Result
20:44 - More about file handling errors
21:37 - Error types and returning Result values
23:39 - map_err: transform the type of an error
25:18 - The "?" operator: early return on error
26:00 - Enum "new type" variant used as a function
26:40 - Popular crates that help dealing with errors
26:54 - The main function can return a Result
27:31 - In Summary