Skip to main content

Module source

Module source 

Source

Structs§

FileSource
LiveFileSource
A file source that watches for whole-file rewrites. Unlike FileSource (which only picks up appended bytes via a streaming handle), LiveFileSource re-reads the entire file when its (mtime, size, ino) signature changes, swaps the buffer in place, and bumps a revision counter so callers know to rebuild any per-line state. Intended for source-file-sized inputs being rewritten by an editor or AI agent.
MockSource
A test/utility source whose contents can be appended at runtime.
StdinSource
TransformingSource
A source that wraps another source and applies a PrettifyMode transform to its bytes. Toggling the mode bumps revision() so the event loop rebuilds the line index. Falls back to passing through the inner bytes if the transform fails to parse, surfacing the error via last_error().

Traits§

Source

Functions§

find_tail_offset
Find the byte offset such that bytes[offset..] is exactly the last n logical lines of src (lines delimited by \n; a trailing \n at EOF is not its own line). Returns 0 when the source has fewer than n lines, or src.len() when n == 0.