Title: Hands-on Rust: map_idx causes error E0425(page 81)

The call to map_idx on the render function of map (let idx = map_idx(x, y) ; ) caused error ‘error[E0425]: cannot find function map_idx in this scope’ when building the Dungeon Crawl program for the very first time.

Fixed it by referring to ithe function as Self::map_idx(x, y) based on a Stack Overflow thread.

Also on page 81 when the map field is added to the State struct the second parameter previously passed as State { } to main_loop had to be changed to State::new().

1 Like