Returns a `VecReader` to read vectors line by line from a file. # Example ``` use rustml::vectors::*; // the file contains the following lines: // 1 2 3 // 4 5 6 let mut i = from_file:: ("datasets/testing/vecs.txt").unwrap(); assert_eq!(i.next().unwrap().unwrap(), vec![1, 2, 3]); assert_eq!(i.next().unwrap().unwrap(), vec![4, 5, 6]); ```
(path: &str)
| 193 | /// ``` |
| 194 | /// |
| 195 | pub fn from_file<T: FromStr>(path: &str) -> Result<VecReader<BufReader<File>, T>> { |
| 196 | |
| 197 | Ok(VecReader { |
| 198 | buf: BufReader::<File>::new(try!(File::open(path))), |
| 199 | phantom: PhantomData |
| 200 | }) |
| 201 | } |
| 202 | |
| 203 | /// |
| 204 | pub trait VectorIO { |
no outgoing calls