#[non_exhaustive]pub enum Trim {
None,
Headers,
Fields,
All,
}Expand description
Which whitespace is removed.
Spaces and tabs are removed from the start and end of unquoted fields
and around the quotes of quoted fields (a, "b" ,c), whitespace in
quotes is kept.
use deser_csv::{DeserializerConfig, Trim};
#[derive(deser::Deserialize)]
struct Row {
name: String,
age: u32,
}
let config = DeserializerConfig::builder().trim(Trim::All).build();
let rows: Vec<Row> =
config.from_str("name , age\n \"jane \" , 42\n").unwrap();
assert_eq!((rows[0].name.as_str(), rows[0].age), ("jane ", 42));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
None
Whitespace is kept.
Headers
Whitespace is removed from the names of the columns.
Fields
Whitespace is removed from the fields of records.
All
Whitespace is removed from names and fields.
Trait Implementations§
impl Copy for Trim
impl Eq for Trim
impl StructuralPartialEq for Trim
Auto Trait Implementations§
impl Freeze for Trim
impl RefUnwindSafe for Trim
impl Send for Trim
impl Sync for Trim
impl Unpin for Trim
impl UnsafeUnpin for Trim
impl UnwindSafe for Trim
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