dta 0.5.1

Pure Rust streaming reader and writer for Stata's DTA file format (every released version, 102-119), plus a parser and reader for Stata dictionary (.dct) files.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/// Strips trailing `\n`, `\r`, or `\r\n` bytes from `buffer` in
/// place.
///
/// [`std::io::BufRead::read_line`] includes the terminating `\n` in
/// its output and, on CRLF input, the preceding `\r` as well. This
/// helper normalizes both, plus the rarer case of a bare trailing
/// `\r` at the end of input. Classic Mac `\r`-only line separators
/// between lines are not handled — see the module-level note about
/// line endings in `dct/mod.rs`.
pub(super) fn strip_terminator(buffer: &mut String) {
    while buffer.ends_with(['\n', '\r']) {
        buffer.pop();
    }
}