Rust's BufRead, And When To Use It
Rust is a low-level language, and its standard library is careful to give the programmer lots of control over how things will behave and avoid implicit behavior, especially when that behavior impacts performance. But at the same time, it doesn't want to make the programmer's life harder than it needs to be. As a result, Rust's language features and standard library often give you access to really low-level concepts with no assumptions baked in, but then also give you abstractions you can optionally layer on top.
One example of this is the
Read
andBufRead
traits.Read
is a low-level and unopinionated abstraction for ingesting data from things like files, network sockets, and process input, whileBufRead
represents a specific kind of layer you can choose to put on top ofRead
to make it slightly higher-level.
Source: Rust's BufRead, And When To Use It, an article by Brandon Smith.