A queue is a simple data structure that allows elements to be inserted from one end, called the rear(also called tail), and deleted from the other end, called the front (also called head).
In order to understand queue in rust, consider a group of people climbing a ladder, the person to climb first will be the first one to get down, which is similar to a queue of line, where the first person to get in the queue is the first one to get out of it.
So, a queue is a linear data structure, A very important point is that a queue deletes only the oldest added element.
The most recently added item in the queue must wait at the end of the collection. The item that has been in the collection the longest is at the front. This ordering principle is called
Queues are a very prevalent model for data flow in real life. Consider an office with 30 computers networked with a single printer. When somebody wants to print, their print tasks "get in line" with all the other printing tasks that are waiting. The first task is the next to be completed. If you are last in line, you must wait for all the other tasks to print ahead of you.
It is an abstract data type, which means that we can create our own function in the Queue, but mostly the queues will contain below functions.