pub fn slice(&self, range: impl ops::RangeBounds<TextUnit>) -> SyntaxText<'a> {
        let start = match range.start_bound() {
            Bound::Included(b) => *b,
            Bound::Excluded(b) => *b + TextUnit::from(1u32),
            Bound::Unbounded => self.range.start(),
        };
        let end = match range.end_bound() {
            Bound::Included(b) => *b + TextUnit::from(1u32),
            Bound::Excluded(b) => *b,
            Bound::Unbounded => self.range.end(),
        };
        assert!(
            start <= end,
            "invalid slice, range: {:?}, slice: {:?}",
            self.range,
            (range.start_bound(), range.end_bound()),
        );
        let range = TextRange::from_to(start, end);
        assert!(
            range.is_subrange(&self.range),
            "invalid slice, range: {:?}, slice: {:?}",
            self.range,
            range,
        );
        SyntaxText { node: self.node, range }
    }
/// NB, the offsets here are absolute, and this probably doesn't make sense!
NB, the offsets here are absolute, and this probably doesn't make sense!
NB the offsets here are absolute and this probably doesn ' t make sense!
pub fn slice(&self, range: impl ops::RangeBounds<TextUnit>) -> SyntaxText<'a> {
        let start = match range.start_bound() {
            Bound::Included(b) => *b,
            Bound::Excluded(b) => *b + TextUnit::from(1u32),
            Bound::Unbounded => self.range.start(),
        };
        let end = match range.end_bound() {
            Bound::Included(b) => *b + TextUnit::from(1u32),
            Bound::Excluded(b) => *b,
            Bound::Unbounded => self.range.end(),
        };
        assert!(
            start <= end,
            "invalid slice, range: {:?}, slice: {:?}",
            self.range,
            (range.start_bound(), range.end_bound()),
        );
        let range = TextRange::from_to(start, end);
        assert!(
            range.is_subrange(&self.range),
            "invalid slice, range: {:?}, slice: {:?}",
            self.range,
            range,
        );
        SyntaxText { node: self.node, range }
    }
pub fn slice ( & self , range : impl ops :: RangeBounds < TextUnit > ) -> SyntaxText < ' a > { let start = match range . start_bound ( ) { Bound :: Included ( b ) => * b , Bound :: Excluded ( b ) => * b + TextUnit :: from ( 1u32 ) , Bound :: Unbounded => self . range . start ( ) , } ; let end = match range . end_bound ( ) { Bound :: Included ( b ) => * b + TextUnit :: from ( 1u32 ) , Bound :: Excluded ( b ) => * b , Bound :: Unbounded => self . range . end ( ) , } ; assert ! ( start end " " self range ( range start_bound ( ) range end_bound ( ) ) ) ; let range = TextRange :: from_to ( start , end ) ; assert ! ( range is_subrange ( self range ) " " self range range ) ; SyntaxText { node : self . node , range } }
NB, the offsets here are absolute, and this probably doesn't make sense!
NB the offsets here are absolute and this probably doesn ' t make sense!
&self
range
impl ops::RangeBounds<TextUnit>
&self
range
impl ops::RangeBounds<TextUnit>