Thank you @TinBryn, that is along the lines I was looking for. Just to note that the only cast required is in the `update` method above. All the other calls to `StateFn( .. )` can be omitted, i.e. return lo Run
works the same as return StateFn(lo) Run I had expected the compiler to complain about the casting, but even with all the `{.gcsafe.}` directives there are no warnings.