pub struct LoadOptions {
pub delimiter: Delimiter,
pub has_header: bool,
pub skip_rows: usize,
pub max_rows: Option<usize>,
pub sheet_index: Option<usize>,
pub sheet_name: Option<String>,
pub infer_schema: bool,
pub infer_schema_length: Option<usize>,
}Expand description
Configuration options for loading data files.
This struct uses the builder pattern for a flexible, extensible API.
§Examples
use dataload::{LoadOptions, Delimiter};
// Default options
let opts = LoadOptions::default();
// Custom options
let opts = LoadOptions::new()
.with_delimiter(Delimiter::Tab)
.with_header(false)
.with_skip_rows(1);Fields§
§delimiter: DelimiterThe delimiter to use for CSV parsing.
has_header: boolWhether the first row contains headers.
skip_rows: usizeNumber of rows to skip from the start.
max_rows: Option<usize>Maximum number of rows to read (None = all rows).
sheet_index: Option<usize>For Excel files: which sheet to read (0-indexed).
None means read the first sheet.
sheet_name: Option<String>For Excel files: sheet name to read.
Takes precedence over sheet_index if both are set.
infer_schema: boolWhether to infer data types for columns.
infer_schema_length: Option<usize>Number of rows to use for schema inference.
Implementations§
Source§impl LoadOptions
impl LoadOptions
Sourcepub const fn with_delimiter(self, delimiter: Delimiter) -> Self
pub const fn with_delimiter(self, delimiter: Delimiter) -> Self
Sets the delimiter for CSV parsing.
Use Delimiter::Auto (default) for automatic detection.
Sourcepub const fn with_header(self, has_header: bool) -> Self
pub const fn with_header(self, has_header: bool) -> Self
Sets whether the first row contains headers.
Default is true.
Sourcepub const fn with_skip_rows(self, skip_rows: usize) -> Self
pub const fn with_skip_rows(self, skip_rows: usize) -> Self
Sets the number of rows to skip from the start of the file.
This is applied before header detection, so if skip_rows = 1
and has_header = true, the second row becomes the header.
Sourcepub const fn with_max_rows(self, max_rows: Option<usize>) -> Self
pub const fn with_max_rows(self, max_rows: Option<usize>) -> Self
Sets the maximum number of rows to read.
None means read all rows (default).
Sourcepub const fn with_sheet_index(self, index: usize) -> Self
pub const fn with_sheet_index(self, index: usize) -> Self
Sets the sheet index to read from Excel files (0-indexed).
Sourcepub fn with_sheet_name(self, name: impl Into<String>) -> Self
pub fn with_sheet_name(self, name: impl Into<String>) -> Self
Sets the sheet name to read from Excel files.
Takes precedence over sheet_index if both are set.
Sourcepub const fn with_infer_schema(self, infer: bool) -> Self
pub const fn with_infer_schema(self, infer: bool) -> Self
Sets whether to infer data types for columns.
Default is true.
Sourcepub const fn with_infer_schema_length(self, length: Option<usize>) -> Self
pub const fn with_infer_schema_length(self, length: Option<usize>) -> Self
Sets the number of rows to use for schema inference.
None means use all rows. Default is Some(1000).
Trait Implementations§
Source§impl Clone for LoadOptions
impl Clone for LoadOptions
Source§fn clone(&self) -> LoadOptions
fn clone(&self) -> LoadOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LoadOptions
impl Debug for LoadOptions
Auto Trait Implementations§
impl Freeze for LoadOptions
impl RefUnwindSafe for LoadOptions
impl Send for LoadOptions
impl Sync for LoadOptions
impl Unpin for LoadOptions
impl UnwindSafe for LoadOptions
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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