pub struct CsvAdapter { /* private fields */ }Expand description
CSV backend adapter.
Semantics:
- A CSV file is treated as a single-sheet workbook (default sheet name:
Sheet1). - UTF-8 only.
- Formulas/styles/tables/named ranges are not supported.
Implementations§
Source§impl CsvAdapter
impl CsvAdapter
pub fn new() -> Self
pub fn new_with_options( read_options: CsvReadOptions, write_options: CsvWriteOptions, ) -> Self
pub fn read_options(&self) -> &CsvReadOptions
pub fn write_options(&self) -> &CsvWriteOptions
pub fn set_write_options(&mut self, opts: CsvWriteOptions)
pub fn open_path_with_options<P: AsRef<Path>>( path: P, read_options: CsvReadOptions, ) -> Result<Self, IoError>
pub fn open_reader_with_options( reader: Box<dyn Read + Send + Sync>, read_options: CsvReadOptions, ) -> Result<Self, IoError>
pub fn open_bytes_with_options( bytes: Vec<u8>, read_options: CsvReadOptions, ) -> Result<Self, IoError>
pub fn write_sheet_to<'a>( &self, sheet: &str, dest: SaveDestination<'a>, opts: CsvWriteOptions, ) -> Result<Option<Vec<u8>>, IoError>
pub fn write_range_to<'a>( &self, sheet: &str, start: (u32, u32), end: (u32, u32), dest: SaveDestination<'a>, opts: CsvWriteOptions, ) -> Result<Option<Vec<u8>>, IoError>
Trait Implementations§
Source§impl Default for CsvAdapter
impl Default for CsvAdapter
Source§impl<R> EngineLoadStream<R> for CsvAdapterwhere
R: EvaluationContext,
impl<R> EngineLoadStream<R> for CsvAdapterwhere
R: EvaluationContext,
Source§impl SpreadsheetReader for CsvAdapter
impl SpreadsheetReader for CsvAdapter
type Error = IoError
fn access_granularity(&self) -> AccessGranularity
fn capabilities(&self) -> BackendCaps
fn sheet_names(&self) -> Result<Vec<String>, Self::Error>
Source§fn open_path<P: AsRef<Path>>(path: P) -> Result<Self, Self::Error>where
Self: Sized,
fn open_path<P: AsRef<Path>>(path: P) -> Result<Self, Self::Error>where
Self: Sized,
Constructor variants for different environments
fn open_reader(reader: Box<dyn Read + Send + Sync>) -> Result<Self, Self::Error>where
Self: Sized,
fn open_bytes(data: Vec<u8>) -> Result<Self, Self::Error>where
Self: Sized,
fn read_range( &mut self, sheet: &str, start: (u32, u32), end: (u32, u32), ) -> Result<BTreeMap<(u32, u32), CellData>, Self::Error>
fn read_sheet(&mut self, sheet: &str) -> Result<SheetData, Self::Error>
fn sheet_bounds(&self, sheet: &str) -> Option<(u32, u32)>
fn is_loaded(&self, _sheet: &str, _row: Option<u32>, _col: Option<u32>) -> bool
Source§fn defined_names(&mut self) -> Result<Vec<DefinedName>, Self::Error>
fn defined_names(&mut self) -> Result<Vec<DefinedName>, Self::Error>
Workbook-level defined names (workbook scoped or sheet scoped). Read more
fn read_cell( &mut self, sheet: &str, row: u32, col: u32, ) -> Result<Option<CellData>, Self::Error>
Source§impl SpreadsheetWriter for CsvAdapter
impl SpreadsheetWriter for CsvAdapter
type Error = IoError
fn write_cell( &mut self, sheet: &str, row: u32, col: u32, data: CellData, ) -> Result<(), Self::Error>
fn write_range( &mut self, sheet: &str, cells: BTreeMap<(u32, u32), CellData>, ) -> Result<(), Self::Error>
fn clear_range( &mut self, sheet: &str, start: (u32, u32), end: (u32, u32), ) -> Result<(), Self::Error>
fn create_sheet(&mut self, name: &str) -> Result<(), Self::Error>
fn delete_sheet(&mut self, name: &str) -> Result<(), Self::Error>
fn rename_sheet(&mut self, old: &str, new: &str) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Source§fn save_to<'a>(
&mut self,
dest: SaveDestination<'a>,
) -> Result<Option<Vec<u8>>, Self::Error>
fn save_to<'a>( &mut self, dest: SaveDestination<'a>, ) -> Result<Option<Vec<u8>>, Self::Error>
Advanced save: specify destination (in place, path, writer, or bytes in memory).
Returns Ok(Some(bytes)) only for Bytes destination, else Ok(None).
fn save(&mut self) -> Result<(), Self::Error>
fn save_as_path<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Self::Error>
fn save_to_bytes(&mut self) -> Result<Vec<u8>, Self::Error>
fn write_to<W: Write>(&mut self, writer: &mut W) -> Result<(), Self::Error>
Auto Trait Implementations§
impl Freeze for CsvAdapter
impl RefUnwindSafe for CsvAdapter
impl Send for CsvAdapter
impl Sync for CsvAdapter
impl Unpin for CsvAdapter
impl UnsafeUnpin for CsvAdapter
impl UnwindSafe for CsvAdapter
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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