swym
swym copied to clipboard
Simple tree using swym
Hi there,
I'm trying to write a simple BST in swym based on this Mutex implementation I wrote. I'm reading through swym-rbtree
for inspiration now, but it's a lot more complicated and confusing.
Could you give me any pointers (haha) on the easiest way to translate this? I think TPtr
makes sense instead of TCell
to avoid cloning, but I don't see examples of TPtr
in swym except for TPtr::privatize_as_box
.
I would appreciate any advice!
I'm running into similar issues trying to implement a queue/vec wrapped in a TCell/Tptr. "get" doesn't work since those collections don't inherently implement the copy marker, and borrow_mut doesn't work either.
Ideally, I'd like my data struct to have Arc<TCell<VecDeq or Arc<TCell<Vec, or either one without them being wrapped in an Arc that can be pushed/popped across multiple threads. I'm running into multiple issues with "get" and "borrow_mut" to allow for push/pop using the inherent vec/ve_deque capabilities.
Any advice is highly appreciated! I don't want to implement an entirely new queue structure, but it might result to that.