I have code similar to the following: fn f1<const B: bool>(x:u64) { } fn f2<const B: bool>(x:u64) { match B { true => f1: ...
I have code similar to the following: fn f1<const B: bool>(x:u64) { } fn f2<const B: bool>(x:u64) { match B { true => f1: ...
I have a trait that does work on data which is bounded in several dimensions, so I create it with const generics allowing me to define those bounds: ...
I want to do which is obviously safe to do. Rust rejects it as Is there some way around this? ...
I am no expert in const generics but I've tried a couple of different approaches, all with issues, when trying out new type instantiations that involv ...
I am trying to make use of the currently unstable feature generic_const_exprs to allow the users of my library to know the resulting dimensions of the ...
I’m writing a fixed-size bit sequence type in Rust with the nightly features generic_const_exprs and int_roundings, and I’m able to impl BitAndAssign ...
I'm currently implementing a ray tracer following along the book "The Ray Tracer Challenge" by Jamis Buck. I've arrived at the part where I have to i ...
I am trying to learn more about const generics and how they can apply to some grid algorithms in any dimensions. Below is a snippet - how can I create ...
I have a trait that look like this: pub trait Buf<const N: usize> { fn to_buf(&self) -> [u8; N]; fn from_buf(buf: [u8; N]) -> ...
I believe that the following code makes sense: trait FooConst<const N: usize> {} trait Foo {} impl<T: FooConst<N>, const N: usize> ...
So for a library I am writing, I want to calculate the distance between two points in N dimensions (2, 3, 4, etc...) and I have a Point trait so that ...
Consider the classic example of a const-generic datastructure: a square matrix. struct Matrix<T, const N: usize> { inner: [[T; N]; N] } I ...
So say I'm writing a wrapper type for the array. And I have some function that mutates the length of the array wrapper, say the function is concate ...
I need to adapt the interior length of variants of the same struct according to a runtime parameter. The structs are defined generically and differ on ...