larix,

Well, that explains why it’s technically possible.

As for why Option<&str> is preferrable then: It hides away your internals. Your caller should only care whether they can get the value or not (Some vs. None), not what the precise reason is. That reason or your internal structure might change.

Yes, that makes sense too. Great!

I’ve updated the code as recommended.

@Ephera@jcbritobr@mastodon.social

  • All
  • Subscribed
  • Moderated
  • Favorites
  • rust@programming.dev
  • rosin
  • ethstaker
  • tacticalgear
  • osvaldo12
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • Youngstown
  • everett
  • InstantRegret
  • slotface
  • ngwrru68w68
  • kavyap
  • JUstTest
  • GTA5RPClips
  • Leos
  • modclub
  • cisconetworking
  • Durango
  • khanakhh
  • cubers
  • normalnudes
  • anitta
  • tester
  • megavids
  • provamag3
  • lostlight
  • All magazines