diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-17 08:04:21 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-08-19 11:41:22 +0200 |
commit | 91074b6e7e6e8463f15ca26bc39e70b80f954227 (patch) | |
tree | 7db7159df67faed9c5a7954a07a064cadcb0497e /tests/misc.rs | |
parent | 0f2d667eb08762b744ef5a18d6c09f99c9c1b8bb (diff) |
refactor!: make Position generic over offset type
Previously Span was generic over R just
so that it could provide the method:
fn from_reader(reader: &R) -> Self;
and properly implementing that method again
relied on R implementing the Position trait:
impl<P: Position> Span<P> for Range<usize> { .. }
which was a very roundabout and awkward way of doing things.
It makes much more sense to make the Position trait generic
over the return type of its method (which previously always had
to be usize). Which lets us provide a blanket implementation:
impl<R: Reader> Position<NoopOffset> for R { .. }
Diffstat (limited to 'tests/misc.rs')
0 files changed, 0 insertions, 0 deletions