pub struct CandleReader<R: Read> { /* private fields */ }Expand description
Streaming OHLCV CSV reader.
Implementations§
Source§impl CandleReader<BomStripReader<File>>
impl CandleReader<BomStripReader<File>>
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open a CSV file at path.
The first line must be a header row naming the OHLCV columns; a leading UTF-8 BOM and whitespace around values are tolerated.
§Errors
Returns Error::Io if the file cannot be opened and
Error::Malformed if the header does not contain every required
column (timestamp,open,high,low,close,volume).
Source§impl<R: Read> CandleReader<BomStripReader<R>>
impl<R: Read> CandleReader<BomStripReader<R>>
Sourcepub fn from_reader(inner: R) -> Result<Self>
pub fn from_reader(inner: R) -> Result<Self>
Build a reader from any std::io::Read source.
A leading UTF-8 BOM is stripped and the header is validated.
§Errors
Returns Error::Malformed if the header does not contain every
required column.
Source§impl<R: Read> CandleReader<R>
impl<R: Read> CandleReader<R>
Sourcepub fn from_csv_reader(reader: Reader<R>) -> Result<Self>
pub fn from_csv_reader(reader: Reader<R>) -> Result<Self>
Wrap a pre-built csv::Reader; useful for testing or for non-default
reader configuration.
Unlike from_reader this does not strip a BOM —
the caller owns the reader’s configuration — but the header is still
validated.
§Errors
Returns Error::Malformed if the header does not contain every
required column.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for CandleReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for CandleReader<R>where
R: RefUnwindSafe,
impl<R> Send for CandleReader<R>where
R: Send,
impl<R> Sync for CandleReader<R>where
R: Sync,
impl<R> Unpin for CandleReader<R>where
R: Unpin,
impl<R> UnsafeUnpin for CandleReader<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for CandleReader<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more