Skip to main content

CsvAdapter

Struct CsvAdapter 

Source
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

Source

pub fn new() -> Self

Source

pub fn new_with_options( read_options: CsvReadOptions, write_options: CsvWriteOptions, ) -> Self

Source

pub fn read_options(&self) -> &CsvReadOptions

Source

pub fn write_options(&self) -> &CsvWriteOptions

Source

pub fn set_write_options(&mut self, opts: CsvWriteOptions)

Source

pub fn open_path_with_options<P: AsRef<Path>>( path: P, read_options: CsvReadOptions, ) -> Result<Self, IoError>

Source

pub fn open_reader_with_options( reader: Box<dyn Read + Send + Sync>, read_options: CsvReadOptions, ) -> Result<Self, IoError>

Source

pub fn open_bytes_with_options( bytes: Vec<u8>, read_options: CsvReadOptions, ) -> Result<Self, IoError>

Source

pub fn write_sheet_to<'a>( &self, sheet: &str, dest: SaveDestination<'a>, opts: CsvWriteOptions, ) -> Result<Option<Vec<u8>>, IoError>

Source

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

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<R> EngineLoadStream<R> for CsvAdapter

Source§

type Error = IoError

Source§

fn stream_into_engine( &mut self, engine: &mut Engine<R>, ) -> Result<(), Self::Error>

Source§

impl SpreadsheetReader for CsvAdapter

Source§

type Error = IoError

Source§

fn access_granularity(&self) -> AccessGranularity

Source§

fn capabilities(&self) -> BackendCaps

Source§

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,

Constructor variants for different environments
Source§

fn open_reader(reader: Box<dyn Read + Send + Sync>) -> Result<Self, Self::Error>
where Self: Sized,

Source§

fn open_bytes(data: Vec<u8>) -> Result<Self, Self::Error>
where Self: Sized,

Source§

fn read_range( &mut self, sheet: &str, start: (u32, u32), end: (u32, u32), ) -> Result<BTreeMap<(u32, u32), CellData>, Self::Error>

Source§

fn read_sheet(&mut self, sheet: &str) -> Result<SheetData, Self::Error>

Source§

fn sheet_bounds(&self, sheet: &str) -> Option<(u32, u32)>

Source§

fn is_loaded(&self, _sheet: &str, _row: Option<u32>, _col: Option<u32>) -> bool

Source§

fn defined_names(&mut self) -> Result<Vec<DefinedName>, Self::Error>

Workbook-level defined names (workbook scoped or sheet scoped). Read more
Source§

fn read_cell( &mut self, sheet: &str, row: u32, col: u32, ) -> Result<Option<CellData>, Self::Error>

Source§

impl SpreadsheetWriter for CsvAdapter

Source§

type Error = IoError

Source§

fn write_cell( &mut self, sheet: &str, row: u32, col: u32, data: CellData, ) -> Result<(), Self::Error>

Source§

fn write_range( &mut self, sheet: &str, cells: BTreeMap<(u32, u32), CellData>, ) -> Result<(), Self::Error>

Source§

fn clear_range( &mut self, sheet: &str, start: (u32, u32), end: (u32, u32), ) -> Result<(), Self::Error>

Source§

fn create_sheet(&mut self, name: &str) -> Result<(), Self::Error>

Source§

fn delete_sheet(&mut self, name: &str) -> Result<(), Self::Error>

Source§

fn rename_sheet(&mut self, old: &str, new: &str) -> Result<(), Self::Error>

Source§

fn flush(&mut self) -> Result<(), Self::Error>

Source§

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).
Source§

fn save(&mut self) -> Result<(), Self::Error>

Source§

fn save_as_path<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Self::Error>

Source§

fn save_to_bytes(&mut self) -> Result<Vec<u8>, Self::Error>

Source§

fn write_to<W: Write>(&mut self, writer: &mut W) -> Result<(), Self::Error>

Auto Trait Implementations§

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,