pub struct Dialect {
pub delimiter: u8,
pub quote: Quote,
}Expand description
Dialect-level metadata. This type encapsulates the details to be used to derive a
ReaderBuilder object (in the csv crate).
Fields§
§delimiter: u8CSV delimiter (field separator).
quote: QuoteRecord quoting details.
Implementations§
Source§impl Dialect
impl Dialect
Sourcepub fn open_path<P: AsRef<Path>>(&self, path: P) -> Result<Reader<File>>
pub fn open_path<P: AsRef<Path>>(&self, path: P) -> Result<Reader<File>>
Use this Dialect to open a file specified by provided path. Returns a Reader (from the
csv crate). Fails on file opening or reading errors.
Examples found in repository?
examples/worldbank.rs (line 22)
7fn main() {
8 let data_filepath = Path::new(file!())
9 .parent()
10 .unwrap()
11 .join("../tests/data/gdp.csv");
12 let dialect = Dialect {
13 delimiter: b',',
14 // header: Header {
15 // has_header_row: true,
16 // num_preamble_rows: 4,
17 // },
18 quote: Quote::Some(b'"'),
19 // flexible: false,
20 // is_utf8: true,
21 };
22 let mut reader = dialect.open_path(data_filepath).unwrap();
23 let result = reader.records().next();
24 let record = result.unwrap().unwrap();
25 println!("{record:?}");
26}Trait Implementations§
Source§impl From<Dialect> for ReaderBuilder
impl From<Dialect> for ReaderBuilder
Auto Trait Implementations§
impl Freeze for Dialect
impl RefUnwindSafe for Dialect
impl Send for Dialect
impl Sync for Dialect
impl Unpin for Dialect
impl UnwindSafe for Dialect
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> 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>
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