Skip to content

Documentation for VariantArray and VariantNames say their VARIANTS constants are arrays, but they're actually slices #335

@IndigoLily

Description

@IndigoLily

The incorrect documentation:

/// Implements `Strum::VariantNames` which adds an associated constant `VARIANTS` which is an array of discriminant names.

/// Adds a static array with all of the Enum's variants.

/// A trait for retrieving a static array containing all the variants in an Enum.

The actual types:

const VARIANTS: &'static [&'static str];

const VARIANTS: &'static [Self];

I personally think these constants should be actual arrays (because it's much easier to get a slice from an array than vice versa), but I'm not sure how feasible that is in current stable Rust.

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