-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More data structures #1
Comments
sure, open a PR please |
looks like its heap allocated. std is heap free, since zz's main goal is to be usable for systems without dynamic memory. |
For good design on heapless data structures look at japarics heapless. I asked for the publication which hopefully has more things to learn from. rust-embedded/heapless#146 |
Stuff @whitequark does is also interesting to read https://lab.whitequark.org/notes/2016-12-17/owning-collections-in-heap-less-rust/ |
This is a great read. Thank you. I'll remove heap allocations today! I think the ergonomics of the list will be pretty straightforward for stack allocations: new+16 mut list = zxlist::init(); // a list that can container 16 items
list.rpush("hello");
list.rpop(); // "hello" I've noticed your usage of |
yep, that api looks good. note zetzit/zz#53. for discussion on generic list types. convention for constructors is that it needs to take a new self pointer, that is "Type mut new*self". there's no convention for the function name. you could have multiple constructors that construct different states, like default, none, etc. Think of it as "what state is the type in after the constructor is called" |
i wonder if @richfelker would have more reading material on designing heapless data structures. |
great, I pushed a refactor over here and using it over here checkout zetzit/zz#53 now |
sized void should make this possible now |
I have a small list implementation here that we could port over
The text was updated successfully, but these errors were encountered: