Add struct extract and insert function, loosley based on the marshal functions from arm-js