/// Assign a read-only source to an existing `PieceTable`.
///
/// # Example
/// ```
/// use piecetable::PieceTable;
/// let src: Vec<i32> = (0..100).collect();
/// let table = PieceTable::new().src(&src);
/// ```
Assign a read-only source to an existing `PieceTable`.
Assign a read - only source to an existing ` PieceTable ` .
pub fn src(mut self, src: &'a [T]) -> PieceTable<'a, T> {
        let mut pieces = Vec::new();
        if src.len() > 0 {
            pieces.push(Piece {
                start: 0,
                length: src.len(),
                buffer: Original,
            });
        }
        self.original = src;
        self.pieces = pieces;
        self.length = src.len();
        self
    }
pub fn src ( mut self , src : & ' a [ T ] ) -> PieceTable < ' a , T > { let mut pieces = Vec :: new ( ) ; if src . len ( ) > 0 { pieces . push ( Piece { start : 0 , length : src . len ( ) , buffer : Original , } ) ; } self . original = src ; self . pieces = pieces ; self . length = src . len ( ) ; self }
Assign a read-only source to an existing `PieceTable`.
Assign a read - only source to an existing ` PieceTable ` .
mut self
src
&'a [T]
example
```
use piecetable::PieceTable;
let src: Vec = (0..100).collect();
let table = PieceTable::new().src(&src);
```
` ` ` use piecetable :: PieceTable ; let src : Vec = ( 0 .. 100 ) . collect () ; let table = PieceTable :: new () . src ( &src ) ; ` ` `