Dynamic Typing in Rust


I need to read in a table of data where each entry in a given column has a fixed type from a small predetermined set. Unfortunately, the type of each column is unknown at compile time, but only once the file is read. What is the best way of storing this data in Rust and perform a small set of predefined operations? Would you define an enum that can encode different types? Thanks a lot for your help!

Yes, an enum is usually a fit solution if you have a known set of types.

1 Like

Thank you!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.