[rust-dev] NewType change in 0.9

benjamin adamson adamson.benjamin at gmail.com
Sat Jan 11 14:03:53 PST 2014


Hello Rust community!

I've been busying myself over the past few weeks learning the different
features of rust, and I have been working on an implementation of Conway's
game of life (while trying to explore different features of rust.

In 0.9, it was changed so that you cannot dereference haskell-like
"NewTypes" with the * operator. In the 0.9 documentation, it says we can
use pattern matching to extract the underlying type.

Right here in my 0.8 code I dererenced the row parameter here:
https://github.com/ShortStomp/ConwayGameOfLife-RUST/blob/master/grid.rs#L42

which is a simple 'NewType', with underlying type uint.

My question is, instead of dereferencing the 'Row' and 'Column' types, how
can I use pattern matching here, to get the underlying uint to index the
array with the code I just linked?

Thanks in advance! :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140111/61e65933/attachment.html>


More information about the Rust-dev mailing list