add gen:custom-write for structs (not finished)