BurntSushi / BurntSushi/rust-csv
how to initialize a record from a Vec with custom struct
Open
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Description
The version I'm using is `csv = "1.1.7"`.
I try to initiate the ByteRecord with Vec.
`#[derive(Debug, Serialize, Deserialize)]
pub struct CustomStruct {
pub type: String,
pub name: String,
}`
Is it possible like this?
`let records: Vec = vec![CustomStruct{type:"hello".to_string(), name: "world".to_string()}];`
`let data = ByteRecord::from(records);`
However, the error msg is
`the trait bound `csv::ByteRecord: From<&CustomStruct>` is not satisfied
the following other types implement trait `From`:
>
>
>>`
Please kindly advice.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.