the.bay.news

[generic_const_exprs] Support for basic field access for structs and tuples

Rust Internals
[generic_const_exprs] Support for basic field access for structs and tuples
The following situation happens often: I have a wrapper type around a multidimensional array. I want to make the type generic over the specific dimensions. I want to pack all dimensions into one parameter, so that large generic trees don't have excessively long impl<> notations. The obvious solution is: #![feature(generic_const_exprs)] #[derive(std::marker::ConstParamTy, PartialEq, Eq)] pub struct BoardSize { pub width: usize, pub height: usize, } pub struct Board<const SIZE: BoardSize>...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.