Skip to main content

Module span_bridge

Module span_bridge 

Source
Expand description

Bridge between Praxis spans and rowan’s text offsets.

Praxis Span/BytePos are the source of truth for diagnostics and never leak rowan types outward. Internally, rowan indexes the tree with its own TextSize/TextRange (also byte offsets into UTF-8). Neither type is local to this crate, so the orphan rule forbids From impls between them; these free functions are the only place the two meet (ADR-003).

Prefer the explicit span_to_range / range_to_span calls at the tree boundary over implicit conversions, so every crossing is visible.

Functions§

range_to_span
Convert a rowan TextRange back into a Praxis Span.
span_to_range
Convert a Praxis Span into a rowan TextRange.