Skip to content

Better leverage typenum::Const<N>? #41

@tarcieri

Description

@tarcieri

When the const-generics feature of typenum is enabled, it provides the generic_const_mappings module which contains a Const<N> ZST with ToUInt impls automatically generated by a build script:

https://docs.rs/typenum/latest/typenum/generic_const_mappings/index.html

The typenum::U<N> type alias provides glue between the two types.

I investigated using this as e.g. an alternative to AssocArraySize in #39, but as noted in that issue it involves a viral bound:

impl <const N: usize> ...
where
    ...
    [T; N]: AsRef<ArrayN<T, N>>
    typenum::Const<N>: typenum::ToUInt

where the current approach allows for:

impl <const N: usize> ...
where
    ...
    [T; N]: AssocArraySize + AsRef<ArrayN<T, N>>

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