Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. use csv::{QuoteStyle, WriterBuilder}; // 1.1.1
  2. use serde; // 1.0.97
  3. use std::io;
  4.  
  5. #[derive(serde::Serialize)]
  6. struct Dummy {
  7. abc: String,
  8. def: f64,
  9. }
  10.  
  11. fn main() {
  12. let mut wrt = WriterBuilder::new()
  13. .quote_style(QuoteStyle::NonNumeric)
  14. .from_writer(io::stdout());
  15. wrt.serialize(Dummy {
  16. abc: "1.01".to_string(),
  17. def: 1.01,
  18. }).unwrap();
  19. wrt.serialize(Dummy {
  20. abc: "1.01.01".to_string(),
  21. def: 1.01,
  22. }).unwrap();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement