Thanks! That did work. However I have no idea what this is doing: Row(row): Row, Column(column): Column The way I understood variable declaration, is that it goes:
name : type. What does wrapping the 'name' of the variable with it's type on the LHS of the : as well as having it on the RHS? Is this some special syntax related to 'NewTypes' ?? On Sat, Jan 11, 2014 at 2:06 PM, Steven Fackler <[email protected]> wrote: > Something like this should work: > > > pub fn cell_alive(&self, Row(row): Row, Column(column): Column) -> uint { > > > return match self.inner[row][column].value { > > > dead => 0, > > > alive => 1 > }; > > } > > > Steven Fackler > > > On Sat, Jan 11, 2014 at 2:03 PM, benjamin adamson < > [email protected]> wrote: > >> 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! :) >> >> _______________________________________________ >> Rust-dev mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/rust-dev >> >> >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
