(from any, method *Method)
| 149 | } |
| 150 | |
| 151 | func FetchMethod(from any, method *Method) any { |
| 152 | v := reflect.ValueOf(from) |
| 153 | kind := v.Kind() |
| 154 | if kind != reflect.Invalid { |
| 155 | // Methods can be defined on any type, no need to dereference. |
| 156 | method := v.Method(method.Index) |
| 157 | if method.IsValid() { |
| 158 | return method.Interface() |
| 159 | } |
| 160 | } |
| 161 | panic(fmt.Sprintf("cannot fetch %v from %T", method.Name, from)) |
| 162 | } |
| 163 | |
| 164 | func Slice(array, from, to any) any { |
| 165 | v := reflect.ValueOf(array) |