func (eq *EventQueue) Push(ev Event, rank int) {
	evr := event{Event: ev, Rank: rank, Idx: eq.Max}
	eq.Max++
	heap.Push(eq.Queue, evr)
	if eq.Max+1 < 0 {
		eq.Filter(func(ev Event) bool { return true })
	}
}
Push adds a new event to the heap with a given rank. Previously queued
events with same rank will be out first.
package rl
import (
	"bytes"
	"container/heap"
	"encoding/gob"
)
type Event interface{}
type event struct {
	Event Event  
	Rank  int    
	Idx int
}
type EventQueue struct {
	eventQueue
}
type eventQueue struct {
	Queue *evSliceQueue
	Max   int  
	Min   int  
}
func NewEventQueue() *EventQueue {
	q := &evSliceQueue{}
	heap.Init(q)
	return &EventQueue{eventQueue{
		Queue: q,
		Min:   -1,
	}}
}
func (eq *EventQueue) GobDecode(bs []byte) error {
	r := bytes.NewReader(bs)
	gdec := gob.NewDecoder(r)
	ievq := &eventQueue{}
	err := gdec.Decode(ievq)
	if err != nil {
		return err
	}
	eq.eventQueue = *ievq
	return nil
}
func (eq *EventQueue) GobEncode() ([]byte, error) {
	buf := bytes.Buffer{}
	ge := gob.NewEncoder(&buf)
	err := ge.Encode(&eq.eventQueue)
	return buf.Bytes(), err
}