| Conditions | 3 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.1406 |
| Changes | 0 | ||
| 1 | // Package decode implements BINN decoding. |
||
| 32 | func decodeUnmarshaler(data []byte, v interface{}) error { |
||
| 33 | 1 | rv := reflect.ValueOf(v) |
|
| 34 | |||
| 35 | 1 | unm, ok := rv.Interface().(Unmarshaler) |
|
| 36 | 1 | if !ok { |
|
| 37 | return &InvalidUnmarshalError{reflect.TypeOf(v)} |
||
| 38 | } |
||
| 39 | 1 | err := unm.UnmarshalBINN(data) |
|
| 40 | 1 | if err != nil { |
|
| 41 | return err |
||
| 42 | } |
||
| 43 | |||
| 44 | 1 | return nil |
|
| 45 | } |
||
| 46 |