Refactor `Struct` class ref/set with cfunc env.

And add few tests related to it.