Thanks. I had failed to realize that 'ref radius' would make 'radius' a 
&Box<f32> value.


> On 27 May 2014, at 20:29, Oleg Eterevsky <o...@eterevsky.com> wrote:
> 
> As far as I understand (I'm a newbie too), it means that 'radius' is the 
> reference to the value in the box.
> 
> 
>> On Tue, May 27, 2014 at 10:27 AM, Tommi <rusty.ga...@icloud.com> wrote:
>> What is the meaning of this 'box ref foo' syntax found in the tutorial over 
>> at __http://doc.rust-lang.org/tutorial.html#references
>> 
>> (Sorry for uglifying the link, my posts seem to get flagged as spam if they 
>> contain links)
>> 
>> In short, it's:
>> 
>> enum Shape { Sphere(Box<f32>) }
>> 
>> let shape = Sphere(box 1.0f32);
>> let r = match shape {
>>    Sphere(box ref radius) => *radius
>> };
>> 
>> I thought the 'box' keyword meant: "allocate on heap and wrap into a Box". 
>> That doesn't make sense to me in the context of 'box ref radius'.
>> 
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev@mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev
> 
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to