I use a static library class which has a static generic function, with where T : struct clause.
Also, this function returns ref T.