3 ms·
Can any rust experts tell me that unsafe rust is powerful and expressive enough to let me do anything? I have a use case where I have two iterators on a linked
by nunchuckninja 7y ago
Can any rust experts tell me that unsafe rust is powerful and expressive enough to let me do anything?
I have a use case where I have two iterators on a linked list in nested loops and the second iterators deletes some elements as it goes. Is this something I can express in unsafe rust?
- unrealhoang 7y agoI’m no expert but yes, you can do anything in unsafe as in C can do anything. Unsafe Rust provides you access to raw pointers.
- nunchuckninja 7y agoI'll add more details to see if it helps- C: ``` node prime= list.head; while () { node probe = prime.next; while() { if () //condition on prime.data and probe.data { probe.next = probe.next.next; //& drop stuff } } ```
- pitaj 7y agoYou need to use four space indent to create code blocks, triple-ticks don't work here.