szmer
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
lemtoman@lemmy.ml to Rust Programming@lemmy.ml · 3 years ago

Are there other languages that rust where enums can store data?

message-square
message-square
2
fedilink
7
message-square

Are there other languages that rust where enums can store data?

lemtoman@lemmy.ml to Rust Programming@lemmy.ml · 3 years ago
message-square
2
fedilink
alert-triangle
You must log in or # to comment.
  • northbound_goat
    link
    fedilink
    arrow-up
    7
    ·
    edit-2
    3 years ago

    deleted by creator

    • Ephera@lemmy.ml
      link
      fedilink
      arrow-up
      7
      ·
      3 years ago

      Yeah, in language theory, this kind of thing is called an “Algebraic Data Type”: https://en.wikipedia.org/wiki/Algebraic_data_type

  • OsrsNeedsF2P@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    3 years ago

    Can you give examples? From the description, it seems like most languages (like Java) can store data in enums?

Rust Programming@lemmy.ml

rust@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !rust@lemmy.ml
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 6 users / day
  • 6 users / week
  • 39 users / month
  • 492 users / 6 months
  • 14 local subscribers
  • 8.9K subscribers
  • 378 Posts
  • 922 Comments
  • Modlog
  • mods:
  • Nutomic@lemmy.ml
  • Joe@lemmy.ml
  • AgreeableLandscape@lemmy.ml
  • BE: 0.19.6
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org