butte icon indicating copy to clipboard operation
butte copied to clipboard

Union entries with associated types

Open reyk opened this issue 5 years ago • 0 comments

The official docs has the following example under Unions:

table PointPosition { x:uint; y:uint; }
table MarkerPosition {}
union Position {
  Start:MarkerPosition,
  Point:PointPosition,
  Finish:MarkerPosition
}

This is useful when having the same type for different actions. The workaround is to wrap MarketPosition in two tables Start and Finish.

reyk avatar Mar 06 '20 16:03 reyk