Skip to content

Recipe: Implement Display, Debug for custom type #402

Open
@AndyGauge

Description

@AndyGauge
Crates std
Section 16.2 String Parsing

Given a simple custom type, implement debug and display directly. Do not lean on derive. Similar to this: https://doc.rust-lang.org/1.6.0/std/fmt/trait.Display.html#examples

It is OK for the cookbook to have similar examples to other sources, as this may be the first place someone looks to solve this problem. Do not use an x,y point as the example though. Mixed data types would be ideal.

Let's throw Hash on the sample too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions