Skip to content

Add default!() macro to builtins #19389

Closed
@icorderi

Description

@icorderi

I run into this across several files in my project, I have fields now and then on my structs that I don't care about much about and I want to initialize them to default... initialize them to default... to default.

You get the point.

I would like to suggest adding this macro to the builtins that makes using defaults slightly less painful.

macro_rules! default(
    () => (::std::default::Default::default());
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions