{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/1620","repository_url":"https://api.github.com/repos/rust-lang/rfcs","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1620/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1620/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1620/events","html_url":"https://github.com/rust-lang/rfcs/pull/1620","id":155624333,"number":1620,"title":"regex 1.0","user":{"login":"BurntSushi","id":456674,"avatar_url":"https://avatars.githubusercontent.com/u/456674?v=3","gravatar_id":"","url":"https://api.github.com/users/BurntSushi","html_url":"https://github.com/BurntSushi","followers_url":"https://api.github.com/users/BurntSushi/followers","following_url":"https://api.github.com/users/BurntSushi/following{/other_user}","gists_url":"https://api.github.com/users/BurntSushi/gists{/gist_id}","starred_url":"https://api.github.com/users/BurntSushi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BurntSushi/subscriptions","organizations_url":"https://api.github.com/users/BurntSushi/orgs","repos_url":"https://api.github.com/users/BurntSushi/repos","events_url":"https://api.github.com/users/BurntSushi/events{/privacy}","received_events_url":"https://api.github.com/users/BurntSushi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rfcs/labels/T-libs","name":"T-libs","color":"bfd4f2"}],"state":"open","locked":false,"assignee":{"login":"BurntSushi","id":456674,"avatar_url":"https://avatars.githubusercontent.com/u/456674?v=3","gravatar_id":"","url":"https://api.github.com/users/BurntSushi","html_url":"https://github.com/BurntSushi","followers_url":"https://api.github.com/users/BurntSushi/followers","following_url":"https://api.github.com/users/BurntSushi/following{/other_user}","gists_url":"https://api.github.com/users/BurntSushi/gists{/gist_id}","starred_url":"https://api.github.com/users/BurntSushi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BurntSushi/subscriptions","organizations_url":"https://api.github.com/users/BurntSushi/orgs","repos_url":"https://api.github.com/users/BurntSushi/repos","events_url":"https://api.github.com/users/BurntSushi/events{/privacy}","received_events_url":"https://api.github.com/users/BurntSushi/received_events","type":"User","site_admin":false},"milestone":null,"comments":34,"created_at":"2016-05-18T23:30:44Z","updated_at":"2016-05-22T10:43:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1620","html_url":"https://github.com/rust-lang/rfcs/pull/1620","diff_url":"https://github.com/rust-lang/rfcs/pull/1620.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/1620.patch"},"body":"[rendered](https://github.com/BurntSushi/rfcs/blob/regex-1.0/text/0000-regex-1.0.md)\r\n\r\nPretty much all of the RFC is implemented and can be tracked at this PR: https://github.com/rust-lang-nursery/regex/pull/230\r\n\r\n`rustdoc` output of the corresponding API is also available: http://burntsushi.net/stuff/regex-rfc/regex/"},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/220825734","html_url":"https://github.com/rust-lang/rfcs/pull/1620#issuecomment-220825734","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1620","id":220825734,"user":{"login":"matthieu-m","id":2420441,"avatar_url":"https://avatars.githubusercontent.com/u/2420441?v=3","gravatar_id":"","url":"https://api.github.com/users/matthieu-m","html_url":"https://github.com/matthieu-m","followers_url":"https://api.github.com/users/matthieu-m/followers","following_url":"https://api.github.com/users/matthieu-m/following{/other_user}","gists_url":"https://api.github.com/users/matthieu-m/gists{/gist_id}","starred_url":"https://api.github.com/users/matthieu-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthieu-m/subscriptions","organizations_url":"https://api.github.com/users/matthieu-m/orgs","repos_url":"https://api.github.com/users/matthieu-m/repos","events_url":"https://api.github.com/users/matthieu-m/events{/privacy}","received_events_url":"https://api.github.com/users/matthieu-m/received_events","type":"User","site_admin":false},"created_at":"2016-05-22T10:43:06Z","updated_at":"2016-05-22T10:43:06Z","body":"@BurntSushi: to be honest, I am starting to wonder if the `start` and `end` are even necessary.\r\n\r\nThey can be recovered from the substring quite easily, without even `unsafe` code:\r\n\r\n    fn position(haystack: &str, needle: &str) -> Option<(usize, usize)> {\r\n        let lower = haystack.as_ptr() as usize;\r\n        let upper = lower + haystack.len();\r\n        \r\n        let start = needle.as_ptr() as usize;\r\n        if start < lower || start >= upper || start + needle.len() > upper {\r\n            None\r\n        } else {\r\n            Some((start - lower, start - lower + needle.len()))\r\n        }\r\n    }\r\n\r\nIncluding both options (substring and indices) doubles the size of the return type, which might affect optimizations (such as using registers for the return value); I am thinking that since regex is already quite widely used it might be interesting to see how frequently each alternative is used. If both are widely used, then the `Match` as proposed makes sense to me; however if either the substring or the indices are used much more often that the other, then maybe it is not worth including the alternative directly, and instead allow to recompute it.\r\n\r\nAm I making sense?"}}
{"actor":{"display_login":"matthieu-m"}}