pub fn next_point(&mut self) -> Result<Option<Point>> {
        // Technically we should just check the first byte instead of the first four, but the work
        // required to do that doesn't seem worth it at the moment.
        let time = match self.reader.read_f64::<LittleEndian>() {
            Ok(time) => time,
            Err(byteorder::Error::UnexpectedEOF) => return Ok(None),
            Err(err) => return Err(Error::from(err)),
        };
        let range = try!(self.reader.read_f32::<LittleEndian>());
        let theta = try!(self.reader.read_f32::<LittleEndian>());
        let x = try!(self.reader.read_f32::<LittleEndian>());
        let y = try!(self.reader.read_f32::<LittleEndian>());
        let z = try!(self.reader.read_f32::<LittleEndian>());
        let amplitude = try!(self.reader.read_u16::<LittleEndian>());
        let width = try!(self.reader.read_u16::<LittleEndian>());
        let target_type = try!(TargetType::from_u8(try!(self.reader.read_u8())));
        let target = try!(self.reader.read_u8());
        let num_target = try!(self.reader.read_u8());
        let rg_index = try!(self.reader.read_u16::<LittleEndian>());
        let channel_desc_byte = try!(self.reader.read_u8());
        let mut class_id = None;
        let mut rho = None;
        let mut reflectance = None;
        if self.version.major >= 5 && self.version.minor >= 2 {
            class_id = Some(try!(self.reader.read_u8()));
        }
        // These 5.3 and 5.4 reads are untested, since I don't have a real-world sample file yet.
        if self.version.major >= 5 && self.version.minor >= 3 {
            rho = Some(try!(self.reader.read_f32::<LittleEndian>()));
        }
        if self.version.major >= 5 && self.version.minor >= 4 {
            reflectance = Some(try!(self.reader.read_i16::<LittleEndian>()));
        }
        Ok(Some(Point {
            time: time,
            range: range,
            theta: theta,
            x: x,
            y: y,
            z: z,
            amplitude: amplitude,
            width: width,
            target_type: target_type,
            target: target,
            num_target: num_target,
            rg_index: rg_index,
            facet_number: channel_desc_byte & 0x3,
            high_channel: (channel_desc_byte & 0b01000000) == 0b01000000,
            class_id: class_id,
            rho: rho,
            reflectance: reflectance
        }))
    }
/// Reads the next point from the underlying `Read`.
///
/// # Examples
///
/// ```
/// use sdc::reader::Reader;
/// let mut reader = Reader::from_path("data/4-points-5.0.sdc").unwrap();
/// let point = reader.next_point();
/// ```
Reads the next point from the underlying `Read`.
Reads the next point from the underlying ` Read ` .
pub fn next_point(&mut self) -> Result<Option<Point>> {
        // Technically we should just check the first byte instead of the first four, but the work
        // required to do that doesn't seem worth it at the moment.
        let time = match self.reader.read_f64::<LittleEndian>() {
            Ok(time) => time,
            Err(byteorder::Error::UnexpectedEOF) => return Ok(None),
            Err(err) => return Err(Error::from(err)),
        };
        let range = try!(self.reader.read_f32::<LittleEndian>());
        let theta = try!(self.reader.read_f32::<LittleEndian>());
        let x = try!(self.reader.read_f32::<LittleEndian>());
        let y = try!(self.reader.read_f32::<LittleEndian>());
        let z = try!(self.reader.read_f32::<LittleEndian>());
        let amplitude = try!(self.reader.read_u16::<LittleEndian>());
        let width = try!(self.reader.read_u16::<LittleEndian>());
        let target_type = try!(TargetType::from_u8(try!(self.reader.read_u8())));
        let target = try!(self.reader.read_u8());
        let num_target = try!(self.reader.read_u8());
        let rg_index = try!(self.reader.read_u16::<LittleEndian>());
        let channel_desc_byte = try!(self.reader.read_u8());
        let mut class_id = None;
        let mut rho = None;
        let mut reflectance = None;
        if self.version.major >= 5 && self.version.minor >= 2 {
            class_id = Some(try!(self.reader.read_u8()));
        }
        // These 5.3 and 5.4 reads are untested, since I don't have a real-world sample file yet.
        if self.version.major >= 5 && self.version.minor >= 3 {
            rho = Some(try!(self.reader.read_f32::<LittleEndian>()));
        }
        if self.version.major >= 5 && self.version.minor >= 4 {
            reflectance = Some(try!(self.reader.read_i16::<LittleEndian>()));
        }
        Ok(Some(Point {
            time: time,
            range: range,
            theta: theta,
            x: x,
            y: y,
            z: z,
            amplitude: amplitude,
            width: width,
            target_type: target_type,
            target: target,
            num_target: num_target,
            rg_index: rg_index,
            facet_number: channel_desc_byte & 0x3,
            high_channel: (channel_desc_byte & 0b01000000) == 0b01000000,
            class_id: class_id,
            rho: rho,
            reflectance: reflectance
        }))
    }
pub fn next_point ( & mut self ) -> Result < Option < Point > > { // Technically we should just check the first byte instead of the first four, but the work // required to do that doesn't seem worth it at the moment. let time = match self . reader . read_f64 :: < LittleEndian > ( ) { Ok ( time ) => time , Err ( byteorder :: Error :: UnexpectedEOF ) => return Ok ( None ) , Err ( err ) => return Err ( Error :: from ( err ) ) , } ; let range = try ! ( self reader read_f32 LittleEndian ( ) ) ; let theta = try ! ( self reader read_f32 LittleEndian ( ) ) ; let x = try ! ( self reader read_f32 LittleEndian ( ) ) ; let y = try ! ( self reader read_f32 LittleEndian ( ) ) ; let z = try ! ( self reader read_f32 LittleEndian ( ) ) ; let amplitude = try ! ( self reader read_u16 LittleEndian ( ) ) ; let width = try ! ( self reader read_u16 LittleEndian ( ) ) ; let target_type = try ! ( TargetType from_u8 ( try ( self reader read_u8 ( ) ) ) ) ; let target = try ! ( self reader read_u8 ( ) ) ; let num_target = try ! ( self reader read_u8 ( ) ) ; let rg_index = try ! ( self reader read_u16 LittleEndian ( ) ) ; let channel_desc_byte = try ! ( self reader read_u8 ( ) ) ; let mut class_id = None ; let mut rho = None ; let mut reflectance = None ; if self . version . major >= 5 && self . version . minor >= 2 { class_id = Some ( try ! ( self reader read_u8 ( ) ) ) ; } // These 5.3 and 5.4 reads are untested, since I don't have a real-world sample file yet. if self . version . major >= 5 && self . version . minor >= 3 { rho = Some ( try ! ( self reader read_f32 LittleEndian ( ) ) ) ; } if self . version . major >= 5 && self . version . minor >= 4 { reflectance = Some ( try ! ( self reader read_i16 LittleEndian ( ) ) ) ; } Ok ( Some ( Point { time : time , range : range , theta : theta , x : x , y : y , z : z , amplitude : amplitude , width : width , target_type : target_type , target : target , num_target : num_target , rg_index : rg_index , facet_number : channel_desc_byte & 0x3 , high_channel : ( channel_desc_byte & 0b01000000 ) == 0b01000000 , class_id : class_id , rho : rho , reflectance : reflectance } ) ) }
Reads the next point from the underlying `Read`.
Reads the next point from the underlying ` Read ` .
&mut self
examples
```
use sdc::reader::Reader;
let mut reader = Reader::from_path("data/4-points-5.0.sdc").unwrap();
let point = reader.next_point();
```
` ` ` use sdc :: reader :: Reader ; let mut reader = Reader :: from_path ( " data / 4 - points - 5 . 0 . sdc " ) . unwrap () ; let point = reader . next_point () ; ` ` `