WithPredicate adds the given predicate function, which can control what is pushed to the queue.
(pred func(x T) (T, bool))
| 32 | // WithPredicate adds the given predicate function, which can control what is |
| 33 | // pushed to the queue. |
| 34 | func (q *Queue[T]) WithPredicate(pred func(x T) (T, bool)) *Queue[T] { |
| 35 | q.pred = pred |
| 36 | return q |
| 37 | } |
| 38 | |
| 39 | // Close aborts any pending pops and makes future pushes error. |
| 40 | func (q *Queue[T]) Close() { |