pub trait Ranged {
    // Required method
    fn range(&self) -> &Range;

    // Provided methods
    fn start(&self) -> usize { ... }
    fn end(&self) -> usize { ... }
    fn text<'a>(&self, text: &'a str) -> &'a str { ... }
    fn width(&self) -> usize { ... }
}
Expand description

Represents an object that has a range in the text.

Required Methods§

source

fn range(&self) -> &Range

Gets the range.

Provided Methods§

source

fn start(&self) -> usize

Gets the byte index of the first character in the text.

source

fn end(&self) -> usize

Gets the byte index after the last character in the text.

source

fn text<'a>(&self, text: &'a str) -> &'a str

Gets the text from the provided string.

source

fn width(&self) -> usize

Gets the end byte index minus the start byte index of the range.

Implementors§

source§

impl Ranged for BooleanLit

source§

impl Ranged for NullKeyword

source§

impl Ranged for Range

source§

impl<'a> Ranged for Comment<'a>

source§

impl<'a> Ranged for ObjectPropName<'a>

source§

impl<'a> Ranged for Value<'a>

source§

impl<'a> Ranged for Array<'a>

source§

impl<'a> Ranged for CommentBlock<'a>

source§

impl<'a> Ranged for CommentLine<'a>

source§

impl<'a> Ranged for NumberLit<'a>

source§

impl<'a> Ranged for Object<'a>

source§

impl<'a> Ranged for ObjectProp<'a>

source§

impl<'a> Ranged for StringLit<'a>

source§

impl<'a> Ranged for WordLit<'a>

source§

impl<'a> Ranged for TokenAndRange<'a>

source§

impl<'a, 'b> Ranged for Node<'a, 'b>