Skip to main content

Module sources

Module sources 

Source
Available on crate feature blob only.
Expand description

Modified for gitoxide from the upstream imara-diff crate. Upstream source: git cat-file -p 32d1e45d3df061e6ccba6db7fdce92db29e345d8:src/sources.rs

Utilities for creating token sources from common data types.

This module provides implementations of TokenSource for strings and byte slices, splitting them into lines by default.

Structs§

BStrLines
A TokenSource that returns the lines of a BStr as tokens. See bstr_lines for details.
ByteLines
A TokenSource that returns the lines of a byte slice as tokens. See byte_lines for details.
Lines
A TokenSource that returns the lines of a str as tokens. See lines for details.
Words
A TokenSource that returns the words of a string as tokens. See words for details.

Functions§

bstr_lines
Returns a TokenSource that uses the lines in data as Tokens. The newline separator (\r\n or \n) is included in the emitted tokens. This means that changing the newline separator from \r\n to \n (or omitting it fully on the last line) is detected when computing a Diff.
byte_lines
Returns a TokenSource that uses the lines in data as Tokens. The newline separator (\r\n or \n) is included in the emitted tokens. This means that changing the newline separator from \r\n to \n (or omitting it fully on the last line) is detected when computing a Diff.
lines
Returns a TokenSource that uses the lines in data as Tokens. The newline separator (\r\n or \n) is included in the emitted tokens. This means that changing the newline separator from \r\n to \n (or omitting it fully on the last line) is detected by Diff.
words
Returns a TokenSource that uses the words in data as Tokens. A word is a sequence of alphanumeric characters as determined by char::is_alphanumeric, or a sequence of just the space character ’ ’. Any other characters are their own word.