pub fn relative_to<X: Into<Span>>(&self, scope: X) -> Result<Range> {
        let scope: Span = scope.into();
        let scope: Range = scope.try_into()?;
        let me: Range = self.try_into()?;
        if scope.start > me.start {
            return Err(Error::Span(format!(
                "start of {me:?} is not inside of {scope:?}",
            )));
        }
        if scope.end < me.end {
            return Err(Error::Span(format!(
                "end of {me:?} is not inside of {scope:?}",
            )));
        }
        let offset = me.start - scope.start;
        let length = me.end - me.start;
        let range = Range {
            start: offset,
            end: offset + length,
        };
        Ok(range)
    }
Converts a span to a range, where `self` is converted to a range
relative to the passed span `scope`. Only works for literals spanning a
single line and the scope full contains `self, otherwise an an `Err(..)`
is returned.
doc-chunks/src/span.rs