Module offset

Source
Expand description

Source code offsets.

The Emitter is generic over an Offset. This library comes with two Offset implementations:

  • NoopOffset for when you don’t want to track source offsets
  • usize for when you do want to track source offsets

To use the latter your reader however has to implement Position<usize>. You can easily use any existing reader by wrapping it in the PosTrackingReader struct which implements the Position<usize> trait and takes care of tracking the current position.

Structs§

NoopOffset
A zero-sized no-op implementation of Offset (for when you don’t want to track offsets).
PosTrackingReader
Wraps a Reader so that it implements Position<usize>.

Traits§

Offset
A byte offset in the source.
Position
A trait to be implemented by readers that track their own position.