hashmismatch / freertos.rs

A Rust wrapper for FreeRTOS.
232 stars 22 forks source link

Change the trait bound for Queue elements from Copy to Unpin #33

Open Neo-Zhixing opened 3 years ago

Neo-Zhixing commented 3 years ago

Right now Queue requires that all elements needs to be Copy. This seems correct, because xQueueSend will copy a predetermined bytes from *pvItemToQueue to the queue.

However, let's consider a type that is not Copy. Vec can be cheaply moved because it only contains ptr, capacity and length, but it is not Copy.

I believe that here we only need to require the item to be Unpin to guarantee that they can be freely moved.