Implement storing data in a pointer location #70
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cc #67
This allows the
BBuffer
to use a pointed-to memory location rather than an owned array. Some use-cases would be shared-memory IPC, MMIO, or using a specific memory region on embedded. In my case, I want to use a 64KiB block SRAM for a DMA buffer on an STM32H7. It's not enough to just place theBBuffer
there because I want the state variables to live in ITCM for speed, and I want to be able to use the whole buffer for data. There isn't an option for a typenum that's 2^16 - sizeof(BBuffer) so I can't even construct one of the right size currently.I implemented this similar to other embedded libs I've seen by adding a
BBStorage
trait which is implemented by either aPtrSorage
or anArrayStorage
. It worked out okay, but the ergonomics of theArrayStorage
suffer due to const fns being unable to return generic types. Perhaps someone can think of a solution.