{"action":"created","issue":{"url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/595","labels_url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/595/labels{/name}","comments_url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/595/comments","events_url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/595/events","html_url":"https://github.com/PistonDevelopers/conrod/pull/595","id":112127682,"number":595,"title":"Change Widget::update to mutate the Widget::State rather than return a new one. Move input capturing methods from Widget trait to UiCell.","user":{"login":"mitchmindtree","id":4587373,"avatar_url":"https://avatars.githubusercontent.com/u/4587373?v=3","gravatar_id":"","url":"https://api.github.com/users/mitchmindtree","html_url":"https://github.com/mitchmindtree","followers_url":"https://api.github.com/users/mitchmindtree/followers","following_url":"https://api.github.com/users/mitchmindtree/following{/other_user}","gists_url":"https://api.github.com/users/mitchmindtree/gists{/gist_id}","starred_url":"https://api.github.com/users/mitchmindtree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitchmindtree/subscriptions","organizations_url":"https://api.github.com/users/mitchmindtree/orgs","repos_url":"https://api.github.com/users/mitchmindtree/repos","events_url":"https://api.github.com/users/mitchmindtree/events{/privacy}","received_events_url":"https://api.github.com/users/mitchmindtree/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-19T11:43:50Z","updated_at":"2015-10-19T15:28:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/595","html_url":"https://github.com/PistonDevelopers/conrod/pull/595","diff_url":"https://github.com/PistonDevelopers/conrod/pull/595.diff","patch_url":"https://github.com/PistonDevelopers/conrod/pull/595.patch"},"body":"This change addresses the problem highlighted in #554 where large widgets would be required to allocate an entire new `Widget::State` even for the slightest of changes. This is because the only way of updating the state was to return an entirely new state from the `Widget::update` method.\r\n\r\nThis PR changes the `Widget::update` method so that it no longer returns an `Option<Widget::State>` but instead provides a way of mutating the state via the `State` wrapper which is given via the `UpdateArgs`. All fields not relating to the unique widget state have been moved out of the `State` type and into a `CommonState` type. This allows us to use the `State` type purely as a \"cell\"-like wrapper around the `WidgetState`.\r\n\r\n`State::view` provides immutable access to the `Widget::State`.\r\n`State::update` allows for mutation of the `Widget::State`. When called, it sets a `has_updated` flag, allowing us to check whether or not the `Widget::State` was updated at all following the call of `Widget::update` and in turn allowing us to know whether or not we need to produce a new `Element` for the `Widget`.\r\n\r\nThis change also required moving the input capturing methods from the `Widget` trait to the `UiCell`, to be called within the `Widget::update` if necessary."},"comment":{"url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/comments/149249593","html_url":"https://github.com/PistonDevelopers/conrod/pull/595#issuecomment-149249593","issue_url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/595","id":149249593,"user":{"login":"mitchmindtree","id":4587373,"avatar_url":"https://avatars.githubusercontent.com/u/4587373?v=3","gravatar_id":"","url":"https://api.github.com/users/mitchmindtree","html_url":"https://github.com/mitchmindtree","followers_url":"https://api.github.com/users/mitchmindtree/followers","following_url":"https://api.github.com/users/mitchmindtree/following{/other_user}","gists_url":"https://api.github.com/users/mitchmindtree/gists{/gist_id}","starred_url":"https://api.github.com/users/mitchmindtree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitchmindtree/subscriptions","organizations_url":"https://api.github.com/users/mitchmindtree/orgs","repos_url":"https://api.github.com/users/mitchmindtree/repos","events_url":"https://api.github.com/users/mitchmindtree/events{/privacy}","received_events_url":"https://api.github.com/users/mitchmindtree/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T15:28:24Z","updated_at":"2015-10-19T15:28:24Z","body":"All passing unsafe-less :smile_cat: going to merge!\r\n\r\nPublished as v**0.21.0**."}}