pub fn buffer_range(&self, range: Range<Position>) -> Option<&[char]> {
        let buffer = self.buffer();
        let s = self.offset_position(range.start).unwrap();
        let e = self.offset_position(range.end).unwrap();
        Some(&buffer[s..e])
    }
/// Returns the buffer in a range.
///
/// # Examples
///
/// ```
/// # use edit::editor::Editor;
/// use edit::editor::Position;
/// let mut editor = Editor::new("a a\n\
///                               b b b b\n\
///                               c", 1, 6).unwrap();
/// let c: Vec<char> = "a\n\
///                     b b".chars().collect();
/// let s: &[char] = &c;
/// assert_eq!(editor.buffer_range(Position::new(0, 2)..Position::new(1, 3)), Some(s));
/// ```
Returns the buffer in a range.
Returns the buffer in a range .
pub fn buffer_range(&self, range: Range<Position>) -> Option<&[char]> {
        let buffer = self.buffer();
        let s = self.offset_position(range.start).unwrap();
        let e = self.offset_position(range.end).unwrap();
        Some(&buffer[s..e])
    }
pub fn buffer_range ( & self , range : Range < Position > ) -> Option < & [ char ] > { let buffer = self . buffer ( ) ; let s = self . offset_position ( range . start ) . unwrap ( ) ; let e = self . offset_position ( range . end ) . unwrap ( ) ; Some ( & buffer [ s .. e ] ) }
Returns the buffer in a range.
Returns the buffer in a range .
&self
range
Range<Position>
&self
range
Range<Position>
examples
None
use edit::editor::editor;
use edit::editor::Position;
let mut editor = Editor::new("a a\n\
b b b b\n\
c", 1, 6).unwrap();
let c: Vec = "a\n\
b b".chars().collect();
let s: &[char] = &c
assert_eq!(editor.buffer_range(Position::new(0, 2)..Position::new(1, 3)), Some(s));
```
use edit :: editor :: Position ; let mut editor = Editor :: new ( " a a \ n \ b b b b \ n \ c " 1 6 ) . unwrap () ; let c : Vec = " a \ n \ b b " . chars () . collect () ; let s : & [ char ] = &c assert_eq! ( editor . buffer_range ( Position :: new ( 0 2 ) .. Position :: new ( 1 3 )) Some ( s )) ; ` ` `