{"action":"created","comment":{"url":"https://api.github.com/repos/zig-lang/zig/pulls/comments/181915076","pull_request_review_id":112623764,"id":181915076,"diff_hunk":"@@ -130,6 +130,16 @@ pub fn copy(comptime T: type, dest: []T, source: []const T) void {\n     for (source) |s, i| dest[i] = s;\n }\n \n+pub fn copyRange(comptime T: type, dest: []T, destStart: usize, destEnd: usize, source: []const T, sourceStart: usize, sourceEnd: usize) void {","path":"std/mem.zig","position":4,"original_position":4,"commit_id":"17dc853862a79f24aeda30c67aef00c1087a8435","original_commit_id":"17dc853862a79f24aeda30c67aef00c1087a8435","user":{"login":"BraedonWooding","id":22880786,"avatar_url":"https://avatars1.githubusercontent.com/u/22880786?v=4","gravatar_id":"","url":"https://api.github.com/users/BraedonWooding","html_url":"https://github.com/BraedonWooding","followers_url":"https://api.github.com/users/BraedonWooding/followers","following_url":"https://api.github.com/users/BraedonWooding/following{/other_user}","gists_url":"https://api.github.com/users/BraedonWooding/gists{/gist_id}","starred_url":"https://api.github.com/users/BraedonWooding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BraedonWooding/subscriptions","organizations_url":"https://api.github.com/users/BraedonWooding/orgs","repos_url":"https://api.github.com/users/BraedonWooding/repos","events_url":"https://api.github.com/users/BraedonWooding/events{/privacy}","received_events_url":"https://api.github.com/users/BraedonWooding/received_events","type":"User","site_admin":false},"body":"Yes, I used that but then I realised slicing is soo much easier then just slipped my mind to remove it, even when you go through all your commits it is hard to find little things like this haha.","created_at":"2018-04-16T23:32:44Z","updated_at":"2018-04-16T23:32:45Z","html_url":"https://github.com/zig-lang/zig/pull/891#discussion_r181915076","pull_request_url":"https://api.github.com/repos/zig-lang/zig/pulls/891","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/zig-lang/zig/pulls/comments/181915076"},"html":{"href":"https://github.com/zig-lang/zig/pull/891#discussion_r181915076"},"pull_request":{"href":"https://api.github.com/repos/zig-lang/zig/pulls/891"}},"in_reply_to_id":181882667},"pull_request":{"url":"https://api.github.com/repos/zig-lang/zig/pulls/891","id":179375880,"html_url":"https://github.com/zig-lang/zig/pull/891","diff_url":"https://github.com/zig-lang/zig/pull/891.diff","patch_url":"https://github.com/zig-lang/zig/pull/891.patch","issue_url":"https://api.github.com/repos/zig-lang/zig/issues/891","number":891,"state":"open","locked":false,"title":"Type Independent String Functions","user":{"login":"BraedonWooding","id":22880786,"avatar_url":"https://avatars1.githubusercontent.com/u/22880786?v=4","gravatar_id":"","url":"https://api.github.com/users/BraedonWooding","html_url":"https://github.com/BraedonWooding","followers_url":"https://api.github.com/users/BraedonWooding/followers","following_url":"https://api.github.com/users/BraedonWooding/following{/other_user}","gists_url":"https://api.github.com/users/BraedonWooding/gists{/gist_id}","starred_url":"https://api.github.com/users/BraedonWooding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BraedonWooding/subscriptions","organizations_url":"https://api.github.com/users/BraedonWooding/orgs","repos_url":"https://api.github.com/users/BraedonWooding/repos","events_url":"https://api.github.com/users/BraedonWooding/events{/privacy}","received_events_url":"https://api.github.com/users/BraedonWooding/received_events","type":"User","site_admin":false},"body":"## What is this PR\r\nSee here #912, this explains it in a deeper level.\r\n\r\n## What EXACTLY is in this PR\r\n- Adds 'endsWith' to mem; this is purely since there is a 'startsWith'\r\n- Moves 'join' to stringUtils and makes it type independent according to #912 \r\n- Adds AsciiView and AsciiIterator, and makes Utf8View and Utf8Iterator comply with the standards of #912 \r\n- Adds encode function to Utf8 (to go from codepoint to array of bytes)\r\n- Adds CodepointSequenceLength function to utf8 (to count length of bytes that a codepoint will be)\r\n- Restructured utf8 functions to not have the utf8 prefix as they exist within 'utf8' library now; such that you call them like `utf8.View` rather than `utf8View` should just make the code within it easier to understand :), this is similar to how its been done in Math\r\n- Added representation folder and corresponding index.zig, this is just since most likely we will have around 4 representations (utf8/16, ascii, and char* strings), note: you can access them through std without having to go through representations.\r\n\r\n## What this PR ISN'T\r\n\r\nThis PR is not going to be ANYTHING to do with LOCALE.\r\n\r\nFurthermore this PR isn't going to edit any code to use Unicode string functions as that'll push it away from its focused use, it'll still add tests of course and I presume any new code will use unicode but any old code should continue to use Ascii (and will merge over to ascii views) as for example I don't know if Path.zig just pretends the bytes it gets are ascii but really are unicode or if it reports an error if you give it a unicode or whatever, and due to the size of path.zig along with the fact that Windows uses a special Utf16 version that should be a separate PR :).\r\n\r\n## Checklist\r\n\r\n- [x] Comply Utf8View/Iterator to the View/Iterator standards for string manipulation (basically more functions and some variables have to be named a certain way).\r\n- [x] Build AsciiView\r\n- [x] Expand trim to allow specifying side\r\n- [x] Expand IndexOfPos and its similar forms to allow specifying choosing the highest index that matches or the lowest (though currently it doesn't go back to front if choosing highest, which I think it probably should but I didn't want to add a ton of conditions, though I think I'll make highest a comptime variable then I'll be happy adding more conditions)\r\n- [x] Move join to stringUtils.zig, this is due to the fact that it explicitly requires strings it isn't for memory joining; i.e. as the description says its for joining strings!\r\n- [x] Make trim for strings (i.e. string version independent)\r\n- [x] Cleanup and fix bugs\r\n\r\n## Short Explanation of Views/Iterators\r\n\r\nViews are just a way to view a memory in two ways simultaneously, both as raw data and as what it represents for example utf8 you can index the raw data or the code points it represents (which are u32 instead of u8 for example), you can of course do other actions like comparing views (if same type of course) and slicing/indexing both code points and raw data.  The only function that can return an error is `view.init` which should perform a validity check on the data (there is also an initUnchecked function) as when indexing data there is no reason why it should be invalid.\r\n\r\nIterators just allow you to cycle through a view, they allow you to obtain the 'nextBytes' or the 'nextCodepoint' representing either the next set of bytes or the actual code point for some iterators they are the same thing for example Ascii which will always return a byte array of size 1 for nextBytes (though of course it'll return it as an array rather than an individual element to fit the spec of iterators), for that reason you should commonly use nextCodepoint as that is more efficient in cases like Ascii and the reason you are using iterators is to get the functionality of turning the raw unicode data into code points :).  There are no error throwing functions in iterators, this is to make your loops nicer and your code much nicer :).\r\n\r\n> Note: When I saw no error throwing functions I mean that those functions don't have an opportunity to throw because of the way they were designed; that is IF the data is valid (checked by the initial init) then all the functions won't throw.  If that data isn't valid then that is undefined behaviour, and that is why using `initUnchecked` is typically bad behaviour and you should rather use `try init` :).","created_at":"2018-04-04T12:34:55Z","updated_at":"2018-04-16T23:32:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2e31bbdbaa2e88a2dec7e372e182e9660aa51cf","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zig-lang/zig/pulls/891/commits","review_comments_url":"https://api.github.com/repos/zig-lang/zig/pulls/891/comments","review_comment_url":"https://api.github.com/repos/zig-lang/zig/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zig-lang/zig/issues/891/comments","statuses_url":"https://api.github.com/repos/zig-lang/zig/statuses/17dc853862a79f24aeda30c67aef00c1087a8435","head":{"label":"BraedonWooding:StringUtils","ref":"StringUtils","sha":"17dc853862a79f24aeda30c67aef00c1087a8435","user":{"login":"BraedonWooding","id":22880786,"avatar_url":"https://avatars1.githubusercontent.com/u/22880786?v=4","gravatar_id":"","url":"https://api.github.com/users/BraedonWooding","html_url":"https://github.com/BraedonWooding","followers_url":"https://api.github.com/users/BraedonWooding/followers","following_url":"https://api.github.com/users/BraedonWooding/following{/other_user}","gists_url":"https://api.github.com/users/BraedonWooding/gists{/gist_id}","starred_url":"https://api.github.com/users/BraedonWooding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BraedonWooding/subscriptions","organizations_url":"https://api.github.com/users/BraedonWooding/orgs","repos_url":"https://api.github.com/users/BraedonWooding/repos","events_url":"https://api.github.com/users/BraedonWooding/events{/privacy}","received_events_url":"https://api.github.com/users/BraedonWooding/received_events","type":"User","site_admin":false},"repo":{"id":127983387,"name":"zig","full_name":"BraedonWooding/zig","owner":{"login":"BraedonWooding","id":22880786,"avatar_url":"https://avatars1.githubusercontent.com/u/22880786?v=4","gravatar_id":"","url":"https://api.github.com/users/BraedonWooding","html_url":"https://github.com/BraedonWooding","followers_url":"https://api.github.com/users/BraedonWooding/followers","following_url":"https://api.github.com/users/BraedonWooding/following{/other_user}","gists_url":"https://api.github.com/users/BraedonWooding/gists{/gist_id}","starred_url":"https://api.github.com/users/BraedonWooding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BraedonWooding/subscriptions","organizations_url":"https://api.github.com/users/BraedonWooding/orgs","repos_url":"https://api.github.com/users/BraedonWooding/repos","events_url":"https://api.github.com/users/BraedonWooding/events{/privacy}","received_events_url":"https://api.github.com/users/BraedonWooding/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BraedonWooding/zig","description":"robust, optimal, and clear programming language","fork":true,"url":"https://api.github.com/repos/BraedonWooding/zig","forks_url":"https://api.github.com/repos/BraedonWooding/zig/forks","keys_url":"https://api.github.com/repos/BraedonWooding/zig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BraedonWooding/zig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BraedonWooding/zig/teams","hooks_url":"https://api.github.com/repos/BraedonWooding/zig/hooks","issue_events_url":"https://api.github.com/repos/BraedonWooding/zig/issues/events{/number}","events_url":"https://api.github.com/repos/BraedonWooding/zig/events","assignees_url":"https://api.github.com/repos/BraedonWooding/zig/assignees{/user}","branches_url":"https://api.github.com/repos/BraedonWooding/zig/branches{/branch}","tags_url":"https://api.github.com/repos/BraedonWooding/zig/tags","blobs_url":"https://api.github.com/repos/BraedonWooding/zig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BraedonWooding/zig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BraedonWooding/zig/git/refs{/sha}","trees_url":"https://api.github.com/repos/BraedonWooding/zig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BraedonWooding/zig/statuses/{sha}","languages_url":"https://api.github.com/repos/BraedonWooding/zig/languages","stargazers_url":"https://api.github.com/repos/BraedonWooding/zig/stargazers","contributors_url":"https://api.github.com/repos/BraedonWooding/zig/contributors","subscribers_url":"https://api.github.com/repos/BraedonWooding/zig/subscribers","subscription_url":"https://api.github.com/repos/BraedonWooding/zig/subscription","commits_url":"https://api.github.com/repos/BraedonWooding/zig/commits{/sha}","git_commits_url":"https://api.github.com/repos/BraedonWooding/zig/git/commits{/sha}","comments_url":"https://api.github.com/repos/BraedonWooding/zig/comments{/number}","issue_comment_url":"https://api.github.com/repos/BraedonWooding/zig/issues/comments{/number}","contents_url":"https://api.github.com/repos/BraedonWooding/zig/contents/{+path}","compare_url":"https://api.github.com/repos/BraedonWooding/zig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BraedonWooding/zig/merges","archive_url":"https://api.github.com/repos/BraedonWooding/zig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BraedonWooding/zig/downloads","issues_url":"https://api.github.com/repos/BraedonWooding/zig/issues{/number}","pulls_url":"https://api.github.com/repos/BraedonWooding/zig/pulls{/number}","milestones_url":"https://api.github.com/repos/BraedonWooding/zig/milestones{/number}","notifications_url":"https://api.github.com/repos/BraedonWooding/zig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BraedonWooding/zig/labels{/name}","releases_url":"https://api.github.com/repos/BraedonWooding/zig/releases{/id}","deployments_url":"https://api.github.com/repos/BraedonWooding/zig/deployments","created_at":"2018-04-04T00:12:23Z","updated_at":"2018-04-04T00:12:27Z","pushed_at":"2018-04-14T11:35:15Z","git_url":"git://github.com/BraedonWooding/zig.git","ssh_url":"git@github.com:BraedonWooding/zig.git","clone_url":"https://github.com/BraedonWooding/zig.git","svn_url":"https://github.com/BraedonWooding/zig","homepage":"https://ziglang.org","size":15795,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zig-lang:master","ref":"master","sha":"b7af9edb8a8802c35f1a460f8dafff8643b34639","user":{"login":"zig-lang","id":27973237,"avatar_url":"https://avatars3.githubusercontent.com/u/27973237?v=4","gravatar_id":"","url":"https://api.github.com/users/zig-lang","html_url":"https://github.com/zig-lang","followers_url":"https://api.github.com/users/zig-lang/followers","following_url":"https://api.github.com/users/zig-lang/following{/other_user}","gists_url":"https://api.github.com/users/zig-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/zig-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zig-lang/subscriptions","organizations_url":"https://api.github.com/users/zig-lang/orgs","repos_url":"https://api.github.com/users/zig-lang/repos","events_url":"https://api.github.com/users/zig-lang/events{/privacy}","received_events_url":"https://api.github.com/users/zig-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":40276274,"name":"zig","full_name":"zig-lang/zig","owner":{"login":"zig-lang","id":27973237,"avatar_url":"https://avatars3.githubusercontent.com/u/27973237?v=4","gravatar_id":"","url":"https://api.github.com/users/zig-lang","html_url":"https://github.com/zig-lang","followers_url":"https://api.github.com/users/zig-lang/followers","following_url":"https://api.github.com/users/zig-lang/following{/other_user}","gists_url":"https://api.github.com/users/zig-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/zig-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zig-lang/subscriptions","organizations_url":"https://api.github.com/users/zig-lang/orgs","repos_url":"https://api.github.com/users/zig-lang/repos","events_url":"https://api.github.com/users/zig-lang/events{/privacy}","received_events_url":"https://api.github.com/users/zig-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zig-lang/zig","description":"robust, optimal, and clear programming language","fork":false,"url":"https://api.github.com/repos/zig-lang/zig","forks_url":"https://api.github.com/repos/zig-lang/zig/forks","keys_url":"https://api.github.com/repos/zig-lang/zig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zig-lang/zig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zig-lang/zig/teams","hooks_url":"https://api.github.com/repos/zig-lang/zig/hooks","issue_events_url":"https://api.github.com/repos/zig-lang/zig/issues/events{/number}","events_url":"https://api.github.com/repos/zig-lang/zig/events","assignees_url":"https://api.github.com/repos/zig-lang/zig/assignees{/user}","branches_url":"https://api.github.com/repos/zig-lang/zig/branches{/branch}","tags_url":"https://api.github.com/repos/zig-lang/zig/tags","blobs_url":"https://api.github.com/repos/zig-lang/zig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zig-lang/zig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zig-lang/zig/git/refs{/sha}","trees_url":"https://api.github.com/repos/zig-lang/zig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zig-lang/zig/statuses/{sha}","languages_url":"https://api.github.com/repos/zig-lang/zig/languages","stargazers_url":"https://api.github.com/repos/zig-lang/zig/stargazers","contributors_url":"https://api.github.com/repos/zig-lang/zig/contributors","subscribers_url":"https://api.github.com/repos/zig-lang/zig/subscribers","subscription_url":"https://api.github.com/repos/zig-lang/zig/subscription","commits_url":"https://api.github.com/repos/zig-lang/zig/commits{/sha}","git_commits_url":"https://api.github.com/repos/zig-lang/zig/git/commits{/sha}","comments_url":"https://api.github.com/repos/zig-lang/zig/comments{/number}","issue_comment_url":"https://api.github.com/repos/zig-lang/zig/issues/comments{/number}","contents_url":"https://api.github.com/repos/zig-lang/zig/contents/{+path}","compare_url":"https://api.github.com/repos/zig-lang/zig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zig-lang/zig/merges","archive_url":"https://api.github.com/repos/zig-lang/zig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zig-lang/zig/downloads","issues_url":"https://api.github.com/repos/zig-lang/zig/issues{/number}","pulls_url":"https://api.github.com/repos/zig-lang/zig/pulls{/number}","milestones_url":"https://api.github.com/repos/zig-lang/zig/milestones{/number}","notifications_url":"https://api.github.com/repos/zig-lang/zig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zig-lang/zig/labels{/name}","releases_url":"https://api.github.com/repos/zig-lang/zig/releases{/id}","deployments_url":"https://api.github.com/repos/zig-lang/zig/deployments","created_at":"2015-08-06T00:51:28Z","updated_at":"2018-04-16T15:14:23Z","pushed_at":"2018-04-16T14:50:05Z","git_url":"git://github.com/zig-lang/zig.git","ssh_url":"git@github.com:zig-lang/zig.git","clone_url":"https://github.com/zig-lang/zig.git","svn_url":"https://github.com/zig-lang/zig","homepage":"https://ziglang.org","size":15741,"stargazers_count":1268,"watchers_count":1268,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":81,"mirror_url":null,"archived":false,"open_issues_count":285,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":81,"open_issues":285,"watchers":1268,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zig-lang/zig/pulls/891"},"html":{"href":"https://github.com/zig-lang/zig/pull/891"},"issue":{"href":"https://api.github.com/repos/zig-lang/zig/issues/891"},"comments":{"href":"https://api.github.com/repos/zig-lang/zig/issues/891/comments"},"review_comments":{"href":"https://api.github.com/repos/zig-lang/zig/pulls/891/comments"},"review_comment":{"href":"https://api.github.com/repos/zig-lang/zig/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zig-lang/zig/pulls/891/commits"},"statuses":{"href":"https://api.github.com/repos/zig-lang/zig/statuses/17dc853862a79f24aeda30c67aef00c1087a8435"}},"author_association":"NONE"}}
{"actor":{"display_login":"BraedonWooding"}}