Skip to content

Consider making Corrupt and Incompatible opaque #389

@nicholasbishop

Description

@nicholasbishop

Currently these types are public enums. I don't think this is ideal for creating a stable interface. The enums are marked non_exhaustive, so we can add variants without it being a breaking change, but we can't change the variants' data or remove variants.

And I don't think there's any good reason why a user would want to match on these values, so it's a needlessly expressive part of the API.

So I'm thinking of changing the API to something like:

pub struct Corrupt(CorruptKind);
pub struct Corrupt(IncompatibleKind);

pub(crate) enum CorruptKind {
   // All the variants that are currently in the Corrupt enum.
}

pub(crate) enum IncompatibleKind {
   // All the variants that are currently in the Incompatible enum.
}

The Debug/Display impls will still carry all the same information, you just won't be able to directly access it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions