internal: add ToStruct helper.
internal: add ToStruct helper.

Change-Id: I2a26553db2ee2705a8a9d8ef5ae09ccca7e04867
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6564
Reviewed-by: CUE cueckoo <0f32a827c9a5f00281f936ac78b5ef3ba80a954c@gmail.com>
Reviewed-by: Marcel van Lohuizen <a22d082192f3ccf984644a4f482781f4c2d65180@golang.org>

cuelang/cue