fizyk20/generic-array

Why this crate is needed?

Closed this issue · 4 comments

README says that in Rust you can't create generic struct, trait or function with arrays with generic size. It's not true. In Rust you can write this code:

struct Foo<const N: usize> {
	data: [i32; N]
}

So this crate is useless.

This crate has existed for far longer than const generics have existed in Rust, and code still relies on it.

Furthermore, typenum provides some functionality that is not yet stable in Rust using const generics.

So why don't just deprecate this crate?

Because it provides functionality that still can't be replicated in stable Rust.

For one, you can't use associated constants as const generic parameters, but you can use associated types with typenum.

Effort is indeed underway to port some of the most common use cases away from this crate.

Ok, thanks for the clarification!