Dissect the cb Handler's signature
(cb Handler)
| 174 | |
| 175 | // Dissect the cb Handler's signature |
| 176 | func argInfo(cb Handler) (reflect.Type, int) { |
| 177 | cbType := reflect.TypeOf(cb) |
| 178 | if cbType.Kind() != reflect.Func { |
| 179 | panic("nats: Handler needs to be a func") |
| 180 | } |
| 181 | numArgs := cbType.NumIn() |
| 182 | if numArgs == 0 { |
| 183 | return nil, numArgs |
| 184 | } |
| 185 | return cbType.In(numArgs - 1), numArgs |
| 186 | } |
| 187 | |
| 188 | var emptyMsgType = reflect.TypeOf(&Msg{}) |
| 189 |