onlinepersona,

What am I missing? Seems like it just puts the parameter in Some?

Anti Commercial-AI license

Ephera,

You must’ve read that wrong.

The first example, but formatted differently:


<span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> value </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">"My name is Rho."</span><span style="color:#323232;">;
</span><span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> result </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#323232;">unformat!(</span><span style="color:#183691;">"My {} is {}."</span><span style="color:#323232;">, value);
</span>

Now, result contains:


<span style="color:#0086b3;">Some</span><span style="color:#323232;">((</span><span style="color:#183691;">"name"</span><span style="color:#323232;">, </span><span style="color:#183691;">"Rho"</span><span style="color:#323232;">))
</span>

…because the words “name” and “Rho” in value happened to be at the position of the {}-slots in the unformat!()-pattern.

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