Serialize csv records

    1

    0

    Giovanny Gongora

    Codiga's Rust Recipes

    serialize a tuple

    use std::io;
    
    fn main() -> Result<()> {
      let mut wtr = csv::Writer::from_writer(io::stdout());
      wtr.write_record(&["Name", "Place", "ID"])?;
      wtr.serialize(("Mark", "Sydney", 87))?;
      wtr.serialize(("Ashley", "Dublin", 32))?;
      wtr.serialize(("Akshat", "Delhi", 11))?;
      wtr.flush()?;
      Ok(())
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.