The standard library offers VecDeque which also has cheap (i.e non allocating) conversions to and from Vecs so we can use that directly and reduce the number of unsafe calls in the project.
Note that while all uses of the API of VecQueue were correct its methods were marked as safe but you could accidentally cause undefined behavior:
let queue = VecQueue::new();
queue.pop(); // UB, length isn't checked
The standard library offers
VecDeque
which also has cheap (i.e non allocating) conversions to and fromVec
s so we can use that directly and reduce the number of unsafe calls in the project.Note that while all uses of the API of
VecQueue
were correct its methods were marked as safe but you could accidentally cause undefined behavior: