pub struct ConfigurableCsvWriter { /* private fields */ }Expand description
CSV writer with configurable delimiter, quoting, line endings and precision.
§Example
use oxiphysics_io::csv::{ConfigurableCsvWriter, CsvWriterConfig};
let cfg = CsvWriterConfig { delimiter: ';', precision: 3, ..Default::default() };
let mut w = ConfigurableCsvWriter::new(cfg);
w.write_header(&["x", "y"]);
w.write_f64_row(&[1.0, 2.5]);
let out = w.finish();
assert!(out.starts_with("x;y"));
assert!(out.contains("1.000;2.500"));Implementations§
Source§impl ConfigurableCsvWriter
impl ConfigurableCsvWriter
Sourcepub fn new(config: CsvWriterConfig) -> Self
pub fn new(config: CsvWriterConfig) -> Self
Create a new writer with the given configuration.
Sourcepub fn write_header(&mut self, headers: &[&str])
pub fn write_header(&mut self, headers: &[&str])
Write a header row from string slices.
Sourcepub fn write_f64_row(&mut self, values: &[f64])
pub fn write_f64_row(&mut self, values: &[f64])
Write a row of f64 values.
Sourcepub fn write_str_row(&mut self, values: &[&str])
pub fn write_str_row(&mut self, values: &[&str])
Write a row of string values.
Auto Trait Implementations§
impl Freeze for ConfigurableCsvWriter
impl RefUnwindSafe for ConfigurableCsvWriter
impl Send for ConfigurableCsvWriter
impl Sync for ConfigurableCsvWriter
impl Unpin for ConfigurableCsvWriter
impl UnsafeUnpin for ConfigurableCsvWriter
impl UnwindSafe for ConfigurableCsvWriter
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.