I've created a struct that folks might find to be useful for their own work
https://gist.github.com/aaomidi/0d6a2de928f9e16cf01ddd392d0c6426
How have you solved the problem of passing resource & invoke options down to your functions?
I'm also happy with upstreaming this // someone taking it and upstreaming it if they're interested in it.