Skip to content

Make asset handles !Default #2647

@RedlineTriad

Description

@RedlineTriad

What problem does this solve or, what need does it fill?

Handle currently requires Default to be implemented, which reduces type safety because for many Assets no default makes sense. Removing this requirement would also partially solve #1201, because when creating Text and filling out the values with ..Default::default() style.font will be set to an invalid font Handle and fail to render.

What solution would you like?

The removal of the requirement that all Handles have to implement Default. The reason this requirement exists is because Handle derives Reflect.

What alternative(s) have you considered?

Runtime errors for default handle values where Default is invalid, but this delays the problem feedback and increases iteration time compared to getting the error at compile time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AssetsLoad files from disk to use for things like images, models, and soundsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useX-Needs-SMEThis type of work requires an SME to approve it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions