This has not landed in nightly yet but is being tracked in https://github.com/rust-lang/rust/issues/44580.
It would be good to begin thinking about how to form the right trait bounds for such types.
#[macro_use]
extern crate serde_derive;
#[derive(Serialize, Deserialize)]
struct S<T, const N: usize> {
array: [T; N],
}
Will reopen if the implementation in the compiler ever lands and we start hearing use cases.
Hi, I hope it's ok that I'm commenting on an older thread, but I was wondering if this was being revisited now that const-generics are available on nightly?
The main use case for const-generics would probably be in numerical applications, so I can see the main use case serving a similar role to numpy's .npy or .npz format.
If there is anything I can do to implement this let me know!
I second this as I would like to switch the hnsw
crate to const generics in preparation for its stabilization. Having a feature that enabled those impls would be beneficial. Alternatively, serde could automatically detect if it is on a compatible nightly rust version using select-rustc and enable the const generics impls in that case.
Most helpful comment
I second this as I would like to switch the
hnsw
crate to const generics in preparation for its stabilization. Having a feature that enabled those impls would be beneficial. Alternatively, serde could automatically detect if it is on a compatible nightly rust version using select-rustc and enable the const generics impls in that case.