heapless icon indicating copy to clipboard operation
heapless copied to clipboard

Alignment of internal arrays

Open MabezDev opened this issue 2 years ago • 2 comments
trafficstars

I often reach for heapless::Vec, but find myself having to write a custom slice wrapper due to peripheral alignment constraints have you had any thoughts about introducing a way to constrain the internal buffers alignment some how?

I found a quite nice crate called elain which I used in embedded-fatfs' block device wrapper. It allows the alignment of a field to be defined by a const generic parameter.

MabezDev avatar Sep 29 '23 12:09 MabezDev

I would love this feature too.

JohnScience avatar Dec 24 '23 22:12 JohnScience

@MabezDev You can take a look at my PR where I implemented AlignedVec https://github.com/rust-embedded/heapless/pull/429

JohnScience avatar Dec 26 '23 18:12 JohnScience