Module ggstd::bufio

source ·

Structs

  • Reader implements buffering for an std::io::Read object.
  • Scanner provides a convenient interface for reading data such as a file of newline-delimited lines of text. Successive calls to the Scan method will step through the ‘tokens’ of a file, skipping the bytes between the tokens. The specification of a token is defined by a split function of type SplitFunc; the default split function breaks the input into lines with line termination stripped. Split functions are defined in this package for scanning a file into lines, bytes, UTF-8-encoded runes, and space-delimited words. The client may instead provide a custom split function.
  • Writer implements buffering for an std::io::Write object. If an error occurs writing to a Writer, no more data will be accepted and all subsequent writes, and flush, will return the error. After all data has been written, the client should call the flush method to guarantee all data has been forwarded to the underlying std::io::Write.

Enums

  • Errors returned by Scanner.

Functions

  • scan_bytes is a split function for a Scanner that returns each byte as a token.
  • scan_lines is a split function for a Scanner that returns each line of text, stripped of any trailing end-of-line marker. The returned line may be empty. The end-of-line marker is one optional carriage return followed by one mandatory newline. In regular expression notation, it is \r?\n. The last non-empty line of input will be returned even if it has no newline.