I want to write a generic algorithm exploring a tree with a function header similar to: ``` fn explore(queue: &mut Q) where Q: Insert + Extract { ... } ``` The two traits defined as: ``` pub trait Insert { fn insert(&mut self, value: Item); } pub trait Extract { fn extract(&mut self) -> Option; } ``` The ordering is abstracted away so I can call my algorithm with a stack, queue or even a priority queue if I want to. I can implement these two traits for `Vec` easily since it has only one ordering strategy: stack. However, for `VecDeque`, there is two possible implementation of these operations and of course, it does not make sense to choose one or the other. It doesn't help to split the traits into several (one for each ordering strategies) since we want to abstract the ordering. The solution I envisioned was to create a kind of adapter structure such as: ``` struct Stack where S: Pop + Push { stack: S } ``` Therefore, we would fix the ordering strategy of the underlying collection used (here we require `Pop` and `Push` to use the same ordering strategy. For example with `VecDeque` we have four possible implementations of `Extract` and `Insert` captured by the ordering used: ``` Stack, Front>; Stack, Back>; Queue, Front, Back>; Queue, Back, Front>; ``` The good thing is that we can design a generic search algorithm over these sequences.