{"action":"opened","issue":{"url":"https://api.github.com/repos/tomassedovic/roguelike-tutorial/issues/11","repository_url":"https://api.github.com/repos/tomassedovic/roguelike-tutorial","labels_url":"https://api.github.com/repos/tomassedovic/roguelike-tutorial/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/tomassedovic/roguelike-tutorial/issues/11/comments","events_url":"https://api.github.com/repos/tomassedovic/roguelike-tutorial/issues/11/events","html_url":"https://github.com/tomassedovic/roguelike-tutorial/issues/11","id":175606495,"number":11,"title":"Use `Iterator::sum` instead of `fold`","user":{"login":"tomassedovic","id":104339,"avatar_url":"https://avatars.githubusercontent.com/u/104339?v=3","gravatar_id":"","url":"https://api.github.com/users/tomassedovic","html_url":"https://github.com/tomassedovic","followers_url":"https://api.github.com/users/tomassedovic/followers","following_url":"https://api.github.com/users/tomassedovic/following{/other_user}","gists_url":"https://api.github.com/users/tomassedovic/gists{/gist_id}","starred_url":"https://api.github.com/users/tomassedovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomassedovic/subscriptions","organizations_url":"https://api.github.com/users/tomassedovic/orgs","repos_url":"https://api.github.com/users/tomassedovic/repos","events_url":"https://api.github.com/users/tomassedovic/events{/privacy}","received_events_url":"https://api.github.com/users/tomassedovic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-07T21:06:08Z","updated_at":"2016-09-07T21:06:08Z","closed_at":null,"body":"Rust 1.11.0 has finally stabilised the `sum` iterator method:\r\n\r\nhttps://doc.rust-lang.org/std/iter/trait.Iterator.html#method.sum\r\n\r\nThat means we can change code like this:\r\n\r\n    let bonus = self.get_all_equipped(game).iter().fold(0, |sum, e| sum + e.power_bonus);\r\n\r\nto something like:\r\n\r\n    let bonus = self.get_all_equipped(game).iter().map(|e| e.power_bonus).sum()\r\n\r\nFold is awesome, but this should be easier to explain & understand.\r\n\r\nhttps://github.com/tomassedovic/roguelike-tutorial/blob/11e50b1939b101a0adffa4e4c6fef957a20f593f/src/bin/part-13-adventure-gear.rs#L273-L285"}}
{"actor":{"display_login":"tomassedovic"}}