Struct Reader

Source
pub struct Reader<R: Read> { /* private fields */ }
Expand description

An SBET reader.

Implementations§

Source§

impl Reader<BufReader<File>>

Source

pub fn from_path<P: AsRef<Path>>( path: P, ) -> Result<Reader<BufReader<File>>, Error>

Opens a reader for a path.

§Examples
use pos::sbet::Reader;
let reader = Reader::from_path("data/2-points.sbet").unwrap();
Source§

impl<R: Read> Reader<R>

Source

pub fn read_point(&mut self) -> Result<Option<Point>, Error>

Reads a point from this reader.

Returns none if the file is at its end when this reader starts reading. We have to do it this way since sbet files don’t have a point count.

§Examples
use pos::sbet::Reader;
let mut reader = Reader::from_path("data/2-points.sbet").unwrap();
let point = reader.read_point().unwrap().unwrap();

Trait Implementations§

Source§

impl<R: Debug + Read> Debug for Reader<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R: Read> IntoIterator for Reader<R>

Source§

type Item = Point

The type of the elements being iterated over.
Source§

type IntoIter = ReaderIterator<R>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<R: Debug + Read> Source for Reader<R>

Source§

fn source(&mut self) -> Result<Option<Point>, Error>

Reads one point from the source.

Auto Trait Implementations§

§

impl<R> Freeze for Reader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Reader<R>
where R: RefUnwindSafe,

§

impl<R> Send for Reader<R>
where R: Send,

§

impl<R> Sync for Reader<R>
where R: Sync,

§

impl<R> Unpin for Reader<R>
where R: Unpin,

§

impl<R> UnwindSafe for Reader<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.