Skip to content

Deserialize into a pre-existing struct #855

Closed
@dtolnay

Description

@dtolnay

Example from @BurntSushi - when iterating over rows of a CSV file, we would like to be able to reuse the same five String buffers on every row.

#[derive(Debug, Deserialize, PartialEq)]
struct MBTARow {
    trip_id: String,
    arrival_time: String,
    departure_time: String,
    stop_id: String,
    stop_sequence: i32,
    stop_headsign: String,
    pickup_type: i32,
    drop_off_type: i32,
    timepoint: i32,
}

The use case is similar to Clone::clone_from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions