NewMux returns a newly initialized Mux object that implements the Router interface.
()
| 50 | // NewMux returns a newly initialized Mux object that implements the Router |
| 51 | // interface. |
| 52 | func NewMux() *Mux { |
| 53 | mux := &Mux{tree: &node{}, pool: &sync.Pool{}} |
| 54 | mux.pool.New = func() interface{} { |
| 55 | return NewRouteContext() |
| 56 | } |
| 57 | return mux |
| 58 | } |
| 59 | |
| 60 | // ServeHTTP is the single method of the http.Handler interface that makes |
| 61 | // Mux interoperable with the standard library. It uses a sync.Pool to get and |