{"action":"created","issue":{"url":"https://api.github.com/repos/adeschamps/lcm-rust/issues/22","repository_url":"https://api.github.com/repos/adeschamps/lcm-rust","labels_url":"https://api.github.com/repos/adeschamps/lcm-rust/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/adeschamps/lcm-rust/issues/22/comments","events_url":"https://api.github.com/repos/adeschamps/lcm-rust/issues/22/events","html_url":"https://github.com/adeschamps/lcm-rust/issues/22","id":300106484,"number":22,"title":"Allow publishing in callbacks","user":{"login":"neachdainn","id":2917148,"avatar_url":"https://avatars1.githubusercontent.com/u/2917148?v=4","gravatar_id":"","url":"https://api.github.com/users/neachdainn","html_url":"https://github.com/neachdainn","followers_url":"https://api.github.com/users/neachdainn/followers","following_url":"https://api.github.com/users/neachdainn/following{/other_user}","gists_url":"https://api.github.com/users/neachdainn/gists{/gist_id}","starred_url":"https://api.github.com/users/neachdainn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neachdainn/subscriptions","organizations_url":"https://api.github.com/users/neachdainn/orgs","repos_url":"https://api.github.com/users/neachdainn/repos","events_url":"https://api.github.com/users/neachdainn/events{/privacy}","received_events_url":"https://api.github.com/users/neachdainn/received_events","type":"User","site_admin":false},"labels":[{"id":848496169,"url":"https://api.github.com/repos/adeschamps/lcm-rust/labels/lcm","name":"lcm","color":"dda03e","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-02-26T04:32:54Z","updated_at":"2018-03-02T06:27:50Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Currently, there is no good way to publish messages from within a callback since all of the `Lcm` methods take `&mut self`. Other than the subscribe and unsubscribe methods, the only thing that really needs to be mutable is the `sequence_number` field. Putting that in a `Cell` should fix this issue."},"comment":{"url":"https://api.github.com/repos/adeschamps/lcm-rust/issues/comments/369834002","html_url":"https://github.com/adeschamps/lcm-rust/issues/22#issuecomment-369834002","issue_url":"https://api.github.com/repos/adeschamps/lcm-rust/issues/22","id":369834002,"user":{"login":"neachdainn","id":2917148,"avatar_url":"https://avatars1.githubusercontent.com/u/2917148?v=4","gravatar_id":"","url":"https://api.github.com/users/neachdainn","html_url":"https://github.com/neachdainn","followers_url":"https://api.github.com/users/neachdainn/followers","following_url":"https://api.github.com/users/neachdainn/following{/other_user}","gists_url":"https://api.github.com/users/neachdainn/gists{/gist_id}","starred_url":"https://api.github.com/users/neachdainn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neachdainn/subscriptions","organizations_url":"https://api.github.com/users/neachdainn/orgs","repos_url":"https://api.github.com/users/neachdainn/repos","events_url":"https://api.github.com/users/neachdainn/events{/privacy}","received_events_url":"https://api.github.com/users/neachdainn/received_events","type":"User","site_admin":false},"created_at":"2018-03-02T06:27:50Z","updated_at":"2018-03-02T06:27:50Z","author_association":"CONTRIBUTOR","body":"I go back and forth about keeping the callback system (in addition to whatever other interface we come up with. On one hand, it would be nice to have an interface than someone familiar with the C/C++ version could pick up without having to relearn. On the other, learning how and when to use the `cell` types is fairly complicated.\r\n\r\n> I think that `rocket`, `ws`, and `specs` are all interesting examples of logic and context being separated from the main control flow of the program.\r\n\r\nI'm not familiar with any of those - I'll look into them and see if they inspire any ideas. My work situation is a bit odd at the moment, so I should have a fair amount of time to keep working on things.\r\n\r\n> In the meantime, one option to reduce the number of `Cell` and `RefCell` variables is to put them all together in a struct, and then you can get by with just one `RefCell`. It's not great, but it's a small step.\r\n\r\nWhen I've played around with the old version of `lcm-rust`, I found that the easiest thing to do was to `move` the sending end of channels into the callbacks. It also wasn't great, but it definitely made the code easier to grok."}}
{"actor":{"display_login":"neachdainn"}}