3 ms·
That's correct. In your case you can either model it with a sum type or wrap each variant in its own type and take the union of them. Example: enum Result
by rto_victim 2y ago
That's correct.
In your case you can either model it with a sum type or wrap each variant in its own type and take the union of them.
Example:
enum Result {
Success(String),
Error(String),
}
struct Success(String);
struct Error(String);
type Result = Success | Error;