Struct Format
pub struct Format {
header: bool,
delimiter: Option<u8>,
escape: Option<u8>,
quote: Option<u8>,
terminator: Option<u8>,
comment: Option<u8>,
null_regex: NullRegex,
truncated_rows: bool,
}
Expand description
The format specification for the CSV file
Fields§
§header: bool
§delimiter: Option<u8>
§escape: Option<u8>
§quote: Option<u8>
§terminator: Option<u8>
§comment: Option<u8>
§null_regex: NullRegex
§truncated_rows: bool
Implementations§
§impl Format
impl Format
pub fn with_header(self, has_header: bool) -> Format
pub fn with_header(self, has_header: bool) -> Format
Specify whether the CSV file has a header, defaults to false
When true
, the first row of the CSV file is treated as a header row
pub fn with_delimiter(self, delimiter: u8) -> Format
pub fn with_delimiter(self, delimiter: u8) -> Format
Specify a custom delimiter character, defaults to comma ','
pub fn with_escape(self, escape: u8) -> Format
pub fn with_escape(self, escape: u8) -> Format
Specify an escape character, defaults to None
pub fn with_quote(self, quote: u8) -> Format
pub fn with_quote(self, quote: u8) -> Format
Specify a custom quote character, defaults to double quote '"'
pub fn with_terminator(self, terminator: u8) -> Format
pub fn with_terminator(self, terminator: u8) -> Format
Specify a custom terminator character, defaults to CRLF
pub fn with_comment(self, comment: u8) -> Format
pub fn with_comment(self, comment: u8) -> Format
Specify a comment character, defaults to None
Lines starting with this character will be ignored
pub fn with_null_regex(self, null_regex: Regex) -> Format
pub fn with_null_regex(self, null_regex: Regex) -> Format
Provide a regex to match null values, defaults to ^$
pub fn with_truncated_rows(self, allow: bool) -> Format
pub fn with_truncated_rows(self, allow: bool) -> Format
Whether to allow truncated rows when parsing.
By default this is set to false
and will error if the CSV rows have different lengths.
When set to true then it will allow records with less than the expected number of columns
and fill the missing columns with nulls. If the record’s schema is not nullable, then it
will still return an error.
pub fn infer_schema<R>(
&self,
reader: R,
max_records: Option<usize>,
) -> Result<(Schema, usize), ArrowError>where
R: Read,
pub fn infer_schema<R>(
&self,
reader: R,
max_records: Option<usize>,
) -> Result<(Schema, usize), ArrowError>where
R: Read,
Infer schema of CSV records from the provided reader
If max_records
is None
, all records will be read, otherwise up to max_records
records are read to infer the schema
Returns inferred schema and number of records read
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Format
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnwindSafe for Format
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request