29 releases (19 breaking)

0.19.1 Jun 29, 2023
0.18.0 Jun 12, 2023
0.17.0 Mar 7, 2023
0.16.0 Nov 27, 2022
0.2.4 Mar 10, 2021

#132 in Operating systems

Download history 10/week @ 2023-06-04 23/week @ 2023-06-11 50/week @ 2023-06-18 107/week @ 2023-06-25 45/week @ 2023-07-02 72/week @ 2023-07-09 46/week @ 2023-07-16 14/week @ 2023-07-23 5/week @ 2023-07-30 16/week @ 2023-08-06 40/week @ 2023-08-13 8/week @ 2023-08-20 63/week @ 2023-08-27 42/week @ 2023-09-03 13/week @ 2023-09-10 10/week @ 2023-09-17

128 downloads per month
Used in 2 crates




Basic Text strings and I/O streams

Github Actions CI Status crates.io page docs.rs docs

This repository hosts a project to define a text format called Basic Text, a subset of Unicode that focuses on text: it excludes unprintable control characters, characters which depend on out-of-band information to interpret, non-characters, deprecated characters, and more, while aiming to preserve everything of practical use to plain text and formats built on top of it. See the Book for more information.

It also includes a Rust crate which aims to implement the Basic Text format, providing several utilities:

  • TextString and TextStr are similar to the standard library's String and str, but use the Basic Text string format, along with a text!("...") macro for Basic Text string literals.

  • TextReader and TextWriter are input and output streams which use the Basic Text stream format. On input, content is converted in a way which is lossy with respect to the original bytestream. Output uses the "strict" conversion method, in which invalid content is diagnosed with errors.

  • BufReadText, an extension trait that adds text_lines and text_lines_lossy to BufRead implementations for reading lines from an input stream as BasicText strings.

  • TextDuplexer is a Duplex for reading and writing on an interactive stream using Basic Text.

The code here is usable, and implements everything in the Basic Text spec, but is not very mature or optimized yet.


~165K SLoC