Method overloading for numpy records

The solution I found, thus not sure about side effects…

import numpy as np
import numba as nb
from numba import typed, typeof, njit, int64, types
from numba.extending import overload_method, overload

struct_dtype = np.dtype([('row', np.float64), ('col', np.float64)])
ty = nb.from_dtype(struct_dtype)

@overload_method(types.Record, 'mul')
def test_node(inst,):
    if inst is ty:
        def impl(inst,):
            inst.row *= 100
        return impl

@njit
def test():
    ty_rec = np.zeros(1, dtype=struct_dtype)[0]
    ty_rec.row = 1.0
    ty_rec.col = -1.0
    ty_rec.mul()
    print(ty_rec)

test()