Closed vadixidav closed 6 years ago
Hi! Due to the internals of RMBA
, only four different values fit. They are already taken by &
, &mut
, Box
and Arc
. There is no room for a fifth one.
An interesting thought though, would be to make the entire thing generic so one could compose one's own out of the four provided...
Are the lower bits assumed to be aligned and used for encoding the type?
Either way, what are your thoughts on adding an enum with all the possible things (&
, &mut
, Box
, Rc
, Arc
, and any others).
Are the lower bits assumed to be aligned and used for encoding the type?
Yes. The main purpose of the struct is saving memory without losing performance.
Either way, what are your thoughts on adding an enum with all the possible things (&, &mut, Box, Rc, Arc, and any others).
You mean adding a fifth variant to SlowRMBA? Maybe, but since you talked about performance being the main reason to prefer Rc over Arc, I'm not sure you'll gain much?
Also; right now SlowRMBA is Send
, adding Rc
would take that away.
I do not fully understand how
RMBA
currently works and if it is possible, but I believe it would be beneficial to addRc
toRMBA
for situation where threading is not required. If it isn't possible, perhaps an enum can be added which is effectively the same asSlowRMBA
, except withRc
, and then that can be used to verify the correct operation ofRMBA
instead ofSlowRMBA
. If you wish to do that, I can do it and submit a PR. What are your thoughts?