Struct las::Reader
[−]
[src]
pub struct Reader<R> { pub header: Header, // some fields omitted }
Takes bytes and turns them into points and associated metadata.
Fields
header: Header
LAS header.
Methods
impl Reader<BufReader<File>>
[src]
fn from_path<P: AsRef<Path>>(path: P) -> Result<Reader<BufReader<File>>>
Creates a reader for a file at the given path.
Examples
let reader = Reader::from_path("data/1.0_0.las").unwrap();
impl<R: Read + Seek> Reader<R>
[src]
fn new(read: R) -> Result<Reader<R>>
Creates a new reader from a Read
object.
While Reader::from_path
wraps the underlying File
in a BufReader
, this method does no
such work for you. If you're planning on doing lots of reads, you should probably wrap your
Read
in a BufReader
for performance reasons.
Examples
use std::io::{Cursor, Read}; use std::fs::File; let mut buf = Vec::new(); File::open("data/1.0_0.las").unwrap().read_to_end(&mut buf).unwrap(); let reader = Reader::new(Cursor::new(buf));
fn read(&mut self) -> Result<Option<Point>>
Reads a point.
Examples
let mut reader = Reader::from_path("data/1.0_0.las").unwrap(); // This reader has one point. let point = reader.read().unwrap().unwrap(); assert!(reader.read().unwrap().is_none());
fn read_to_end(&mut self) -> Result<Vec<Point>>
Creates a vector with all the points in this lasfile.
If any of the reads causes an error, returns that error.
Examples
let mut reader = Reader::from_path("data/1.0_0.las").unwrap(); let points = reader.read_to_end().unwrap();
fn iter_mut(&mut self) -> IterMut<R>
Returns an iterator over points.
Examples
let mut reader = Reader::from_path("data/1.0_0.las").unwrap(); let points = reader.iter_mut().collect::<Result<Vec<_>, _>>().unwrap();