onlinepersona, What am I missing? Seems like it just puts the parameter in
Some
?
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.
Add comment