Struct scribe::buffer::Range
[−]
[src]
pub struct Range { /* fields omitted */ }
A two-position type, representing a span of characters.
Methods
impl Range
[src]
fn new(start: Position, end: Position) -> Range
Creates a new buffer range. Checks and swaps arguments in the event that the end precedes the start.
fn start(&self) -> Position
fn end(&self) -> Position
fn includes(&self, position: &Position) -> bool
Whether or not the range includes the specified position. The range is exclusive, such that its ending position is not included.
Examples
use scribe::buffer::{Position, Range}; // Builder a range. let range = Range::new( Position{ line: 0, offset: 0 }, Position{ line: 1, offset: 5 } ); assert!(range.includes( &Position{ line: 1, offset: 0 } )); assert!(range.includes( &Position{ line: 1, offset: 4 } )); assert!(!range.includes( &Position{ line: 1, offset: 5 } ));
Trait Implementations
impl Clone for Range
[src]
fn clone(&self) -> Range
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more