Struct scribe::buffer::Range [] [src]

pub struct Range { /* fields omitted */ }

A two-position type, representing a span of characters.

Methods

impl Range
[src]

Creates a new buffer range. Checks and swaps arguments in the event that the end precedes the start.

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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Range
[src]

Formats the value using the given formatter.

impl PartialEq for Range
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.