{"action":"created","comment":{"url":"https://api.github.com/repos/AltSysrq/proptest/pulls/comments/232508312","pull_request_review_id":173717135,"id":232508312,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjUwODMxMg==","diff_hunk":"@@ -0,0 +1,370 @@\n+# Modifier Reference\n+\n+All modifiers interpreted by `#[derive(Arbitrary)]` are of the form\n+`#[proptest(..)]`, where the content between the parentheses follows the normal\n+Rust attribute syntax.\n+\n+Each modifier within the parentheses is independent, in that putting two\n+modifiers in the same attribute is equivalent to having two `#[proptest(..)]`\n+attributes with one modifier each.\n+\n+For brevity, modifiers are sometimes referenced by name alone; e.g., \"the\n+`weight` modifier\" refers to `#[proptest(weight = nn)]` and not some\n+freestanding `#[weight]` attribute.\n+\n+## `filter`\n+\n+Form: `#[proptest(filter = F)]` or `#[proptest(filter(F))]` where `F` is either\n+a bare identifier or a Rust expression in a string. In either case, the\n+parameter must evaluate to something which is `Fn (&T) -> bool`, where `T` is\n+the type of the item being filtered.\n+\n+Usable on: structs, enums, enum variants, fields\n+\n+The `filter` modifier allows filtering values generated for a field via\n+rejection sampling. Since rejection sampling is inefficient and interferes with\n+shrinking, it should only be used for conditions that are very rare or are\n+unfeasible to express otherwise. In many cases, [`strategy`](#strategy) can be\n+used to more directly express the desired behaviour without rejection sampling.\n+See the documentation for [`prop_filter`] for more details.\n+\n+The argument to the modifier must be a valid argument for the second parameter\n+of [`prop_filter`].\n+\n+Example:\n+\n+```rust\n+#[derive(Debug, Arbitrary)]\n+#[proptest(filter = \"|segment| segment.start != segment.end\")]\n+struct NonEmptySegment {\n+    start: i32,\n+    end: i32,\n+}\n+```\n+\n+As mentioned above, filtering should be avoided when it is reasonably possible\n+to express a non-filtering strategy that achieves the same effect. For example:\n+\n+```rust\n+#[derive(Debug, Arbitrary)]\n+struct BadExapmle {\n+    // Don't do this! Your tests will run more slowly and shrinking won't work\n+    // properly.\n+    #[proptest(filter = \"|x| x % 2 == 0\")]\n+    even_number: u32,\n+}\n+\n+#[derive(Debug, Arbitrary)]\n+struct GoodExample {\n+    // Directly generate even numbers only by transforming the set of all\n+    // `u32`s and then mapping it to the set of even `u32`s.\n+    #[proptest(strategy = \"any::<u32>().prop_map(|x| x / 2 * 2)\")]\n+    even_number: u32,\n+}\n+```\n+\n+[`prop_filter`]: https://altsysrq.github.io/rustdoc/proptest/latest/proptest/strategy/trait.Strategy.html#method.prop_filter\n+\n+## `no_bound`\n+\n+Form: `#[proptest(no_bound)]`\n+\n+Usable on: generic type declarations\n+\n+Normally, when `#[derive(Arbitrary)]` is applied to an item with generic type\n+arguments, every type argument is required to `impl Arbitrary`. For example,\n+given a declaration like the following:\n+\n+```rust\n+#[derive(Arbitrary)]\n+struct MyStruct<T> { /* ... */ }\n+```\n+\n+Something like this will be generated:\n+\n+```rust\n+impl<T> Arbitrary for MyStruct<T> where T: Arbitrary { /* ... */ }\n+```\n+\n+Placing `#[proptest(no_bound)]` on a generic type argument suppresses this. For\n+example, the following removes the extra `where T: Arbitrary`:\n+\n+```rust\n+#[derive(Arbitrary)]\n+struct MyStruct<#[proptest(no_bound)] T> { /* ... */ }\n+```\n+\n+In order for `no_bound` to be useful, one of two things needs to be true:\n+\n+- The nature of the item is such that no value with the generic type actually\n+  comes into existence. This can happen if the only references are things such\n+  as `PhantomData<T>` or if the item is an enum and all variants referencing\n+  the type are marked `#[proptest(skip)]`.\n+\n+- Other modifiers (such as `value`) are added to things referencing the generic\n+  type that remove proptest's responsibility for generating them.\n+\n+Example of the above:\n+\n+```rust\n+#[derive(Debug, Arbitrary)]\n+enum MyEnum<#[proptest(no_bound)] T> {\n+    // OK -- no T needs to be constructed\n+    Phantom(PhantomData<T>),\n+\n+    // OK -- we're manually taking responsibility for generating the value\n+    #[proptest(value = \"MyEnum::WithValue(None)\")]\n+    WithValue(Option<T>),\n+\n+    // OK -- we tell proptest not to generate this case\n+    #[proptest(skip)]\n+    Skipped(T),\n+\n+    // ERROR -- proptest would need to generate a T here, but cannot because\n+    // we lack the `T: Arbitrary` bound due to having used `no_bound`.\n+    Error(T),\n+}\n+```\n+\n+## `no_params`\n+\n+Form: `#[no_params]`","path":"book/src/proptest-derive/modifiers.md","position":131,"original_position":131,"commit_id":"f87eb87dcb5515a9c9bd85403cf0bfb9ee20b18f","original_commit_id":"f87eb87dcb5515a9c9bd85403cf0bfb9ee20b18f","user":{"login":"Centril","id":855702,"node_id":"MDQ6VXNlcjg1NTcwMg==","avatar_url":"https://avatars2.githubusercontent.com/u/855702?v=4","gravatar_id":"","url":"https://api.github.com/users/Centril","html_url":"https://github.com/Centril","followers_url":"https://api.github.com/users/Centril/followers","following_url":"https://api.github.com/users/Centril/following{/other_user}","gists_url":"https://api.github.com/users/Centril/gists{/gist_id}","starred_url":"https://api.github.com/users/Centril/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Centril/subscriptions","organizations_url":"https://api.github.com/users/Centril/orgs","repos_url":"https://api.github.com/users/Centril/repos","events_url":"https://api.github.com/users/Centril/events{/privacy}","received_events_url":"https://api.github.com/users/Centril/received_events","type":"User","site_admin":false},"body":"```suggestion\r\nForm: `#[proptest(no_params)]`\r\n```\r\n\r\nI'd write it out fully; saves some confusion in some cases imo.","created_at":"2018-11-11T22:49:51Z","updated_at":"2018-11-11T22:56:55Z","html_url":"https://github.com/AltSysrq/proptest/pull/104#discussion_r232508312","pull_request_url":"https://api.github.com/repos/AltSysrq/proptest/pulls/104","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/AltSysrq/proptest/pulls/comments/232508312"},"html":{"href":"https://github.com/AltSysrq/proptest/pull/104#discussion_r232508312"},"pull_request":{"href":"https://api.github.com/repos/AltSysrq/proptest/pulls/104"}}},"pull_request":{"url":"https://api.github.com/repos/AltSysrq/proptest/pulls/104","id":228144352,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4MTQ0MzUy","html_url":"https://github.com/AltSysrq/proptest/pull/104","diff_url":"https://github.com/AltSysrq/proptest/pull/104.diff","patch_url":"https://github.com/AltSysrq/proptest/pull/104.patch","issue_url":"https://api.github.com/repos/AltSysrq/proptest/issues/104","number":104,"state":"open","locked":false,"title":"[WIP] Proptest-derive book","user":{"login":"AltSysrq","id":1392512,"node_id":"MDQ6VXNlcjEzOTI1MTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1392512?v=4","gravatar_id":"","url":"https://api.github.com/users/AltSysrq","html_url":"https://github.com/AltSysrq","followers_url":"https://api.github.com/users/AltSysrq/followers","following_url":"https://api.github.com/users/AltSysrq/following{/other_user}","gists_url":"https://api.github.com/users/AltSysrq/gists{/gist_id}","starred_url":"https://api.github.com/users/AltSysrq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AltSysrq/subscriptions","organizations_url":"https://api.github.com/users/AltSysrq/orgs","repos_url":"https://api.github.com/users/AltSysrq/repos","events_url":"https://api.github.com/users/AltSysrq/events{/privacy}","received_events_url":"https://api.github.com/users/AltSysrq/received_events","type":"User","site_admin":false},"body":"Adds the basic mdbook skeleton. This PR will eventually include the full book for `proptest-derive`.\r\n\r\nThere's some stubs for the `proptest` section of the book, but that will not be filled further in the context of this PR.","created_at":"2018-11-03T22:14:05Z","updated_at":"2018-11-11T22:56:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eaaae9c21bf8a7c1069124512ae063a30bc6cf95","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/AltSysrq/proptest/pulls/104/commits","review_comments_url":"https://api.github.com/repos/AltSysrq/proptest/pulls/104/comments","review_comment_url":"https://api.github.com/repos/AltSysrq/proptest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AltSysrq/proptest/issues/104/comments","statuses_url":"https://api.github.com/repos/AltSysrq/proptest/statuses/f87eb87dcb5515a9c9bd85403cf0bfb9ee20b18f","head":{"label":"AltSysrq:proptest-derive-book","ref":"proptest-derive-book","sha":"f87eb87dcb5515a9c9bd85403cf0bfb9ee20b18f","user":{"login":"AltSysrq","id":1392512,"node_id":"MDQ6VXNlcjEzOTI1MTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1392512?v=4","gravatar_id":"","url":"https://api.github.com/users/AltSysrq","html_url":"https://github.com/AltSysrq","followers_url":"https://api.github.com/users/AltSysrq/followers","following_url":"https://api.github.com/users/AltSysrq/following{/other_user}","gists_url":"https://api.github.com/users/AltSysrq/gists{/gist_id}","starred_url":"https://api.github.com/users/AltSysrq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AltSysrq/subscriptions","organizations_url":"https://api.github.com/users/AltSysrq/orgs","repos_url":"https://api.github.com/users/AltSysrq/repos","events_url":"https://api.github.com/users/AltSysrq/events{/privacy}","received_events_url":"https://api.github.com/users/AltSysrq/received_events","type":"User","site_admin":false},"repo":{"id":94702898,"node_id":"MDEwOlJlcG9zaXRvcnk5NDcwMjg5OA==","name":"proptest","full_name":"AltSysrq/proptest","private":false,"owner":{"login":"AltSysrq","id":1392512,"node_id":"MDQ6VXNlcjEzOTI1MTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1392512?v=4","gravatar_id":"","url":"https://api.github.com/users/AltSysrq","html_url":"https://github.com/AltSysrq","followers_url":"https://api.github.com/users/AltSysrq/followers","following_url":"https://api.github.com/users/AltSysrq/following{/other_user}","gists_url":"https://api.github.com/users/AltSysrq/gists{/gist_id}","starred_url":"https://api.github.com/users/AltSysrq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AltSysrq/subscriptions","organizations_url":"https://api.github.com/users/AltSysrq/orgs","repos_url":"https://api.github.com/users/AltSysrq/repos","events_url":"https://api.github.com/users/AltSysrq/events{/privacy}","received_events_url":"https://api.github.com/users/AltSysrq/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AltSysrq/proptest","description":"Hypothesis-like property testing for Rust","fork":false,"url":"https://api.github.com/repos/AltSysrq/proptest","forks_url":"https://api.github.com/repos/AltSysrq/proptest/forks","keys_url":"https://api.github.com/repos/AltSysrq/proptest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AltSysrq/proptest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AltSysrq/proptest/teams","hooks_url":"https://api.github.com/repos/AltSysrq/proptest/hooks","issue_events_url":"https://api.github.com/repos/AltSysrq/proptest/issues/events{/number}","events_url":"https://api.github.com/repos/AltSysrq/proptest/events","assignees_url":"https://api.github.com/repos/AltSysrq/proptest/assignees{/user}","branches_url":"https://api.github.com/repos/AltSysrq/proptest/branches{/branch}","tags_url":"https://api.github.com/repos/AltSysrq/proptest/tags","blobs_url":"https://api.github.com/repos/AltSysrq/proptest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AltSysrq/proptest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AltSysrq/proptest/git/refs{/sha}","trees_url":"https://api.github.com/repos/AltSysrq/proptest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AltSysrq/proptest/statuses/{sha}","languages_url":"https://api.github.com/repos/AltSysrq/proptest/languages","stargazers_url":"https://api.github.com/repos/AltSysrq/proptest/stargazers","contributors_url":"https://api.github.com/repos/AltSysrq/proptest/contributors","subscribers_url":"https://api.github.com/repos/AltSysrq/proptest/subscribers","subscription_url":"https://api.github.com/repos/AltSysrq/proptest/subscription","commits_url":"https://api.github.com/repos/AltSysrq/proptest/commits{/sha}","git_commits_url":"https://api.github.com/repos/AltSysrq/proptest/git/commits{/sha}","comments_url":"https://api.github.com/repos/AltSysrq/proptest/comments{/number}","issue_comment_url":"https://api.github.com/repos/AltSysrq/proptest/issues/comments{/number}","contents_url":"https://api.github.com/repos/AltSysrq/proptest/contents/{+path}","compare_url":"https://api.github.com/repos/AltSysrq/proptest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AltSysrq/proptest/merges","archive_url":"https://api.github.com/repos/AltSysrq/proptest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AltSysrq/proptest/downloads","issues_url":"https://api.github.com/repos/AltSysrq/proptest/issues{/number}","pulls_url":"https://api.github.com/repos/AltSysrq/proptest/pulls{/number}","milestones_url":"https://api.github.com/repos/AltSysrq/proptest/milestones{/number}","notifications_url":"https://api.github.com/repos/AltSysrq/proptest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AltSysrq/proptest/labels{/name}","releases_url":"https://api.github.com/repos/AltSysrq/proptest/releases{/id}","deployments_url":"https://api.github.com/repos/AltSysrq/proptest/deployments","created_at":"2017-06-18T17:38:03Z","updated_at":"2018-11-06T09:24:58Z","pushed_at":"2018-11-11T21:28:54Z","git_url":"git://github.com/AltSysrq/proptest.git","ssh_url":"git@github.com:AltSysrq/proptest.git","clone_url":"https://github.com/AltSysrq/proptest.git","svn_url":"https://github.com/AltSysrq/proptest","homepage":null,"size":1037,"stargazers_count":272,"watchers_count":272,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":15,"open_issues":24,"watchers":272,"default_branch":"master"}},"base":{"label":"AltSysrq:proptest-derive","ref":"proptest-derive","sha":"cba44e4a54c034ed2ee2dd57670f39e30950b9fc","user":{"login":"AltSysrq","id":1392512,"node_id":"MDQ6VXNlcjEzOTI1MTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1392512?v=4","gravatar_id":"","url":"https://api.github.com/users/AltSysrq","html_url":"https://github.com/AltSysrq","followers_url":"https://api.github.com/users/AltSysrq/followers","following_url":"https://api.github.com/users/AltSysrq/following{/other_user}","gists_url":"https://api.github.com/users/AltSysrq/gists{/gist_id}","starred_url":"https://api.github.com/users/AltSysrq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AltSysrq/subscriptions","organizations_url":"https://api.github.com/users/AltSysrq/orgs","repos_url":"https://api.github.com/users/AltSysrq/repos","events_url":"https://api.github.com/users/AltSysrq/events{/privacy}","received_events_url":"https://api.github.com/users/AltSysrq/received_events","type":"User","site_admin":false},"repo":{"id":94702898,"node_id":"MDEwOlJlcG9zaXRvcnk5NDcwMjg5OA==","name":"proptest","full_name":"AltSysrq/proptest","private":false,"owner":{"login":"AltSysrq","id":1392512,"node_id":"MDQ6VXNlcjEzOTI1MTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1392512?v=4","gravatar_id":"","url":"https://api.github.com/users/AltSysrq","html_url":"https://github.com/AltSysrq","followers_url":"https://api.github.com/users/AltSysrq/followers","following_url":"https://api.github.com/users/AltSysrq/following{/other_user}","gists_url":"https://api.github.com/users/AltSysrq/gists{/gist_id}","starred_url":"https://api.github.com/users/AltSysrq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AltSysrq/subscriptions","organizations_url":"https://api.github.com/users/AltSysrq/orgs","repos_url":"https://api.github.com/users/AltSysrq/repos","events_url":"https://api.github.com/users/AltSysrq/events{/privacy}","received_events_url":"https://api.github.com/users/AltSysrq/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AltSysrq/proptest","description":"Hypothesis-like property testing for Rust","fork":false,"url":"https://api.github.com/repos/AltSysrq/proptest","forks_url":"https://api.github.com/repos/AltSysrq/proptest/forks","keys_url":"https://api.github.com/repos/AltSysrq/proptest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AltSysrq/proptest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AltSysrq/proptest/teams","hooks_url":"https://api.github.com/repos/AltSysrq/proptest/hooks","issue_events_url":"https://api.github.com/repos/AltSysrq/proptest/issues/events{/number}","events_url":"https://api.github.com/repos/AltSysrq/proptest/events","assignees_url":"https://api.github.com/repos/AltSysrq/proptest/assignees{/user}","branches_url":"https://api.github.com/repos/AltSysrq/proptest/branches{/branch}","tags_url":"https://api.github.com/repos/AltSysrq/proptest/tags","blobs_url":"https://api.github.com/repos/AltSysrq/proptest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AltSysrq/proptest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AltSysrq/proptest/git/refs{/sha}","trees_url":"https://api.github.com/repos/AltSysrq/proptest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AltSysrq/proptest/statuses/{sha}","languages_url":"https://api.github.com/repos/AltSysrq/proptest/languages","stargazers_url":"https://api.github.com/repos/AltSysrq/proptest/stargazers","contributors_url":"https://api.github.com/repos/AltSysrq/proptest/contributors","subscribers_url":"https://api.github.com/repos/AltSysrq/proptest/subscribers","subscription_url":"https://api.github.com/repos/AltSysrq/proptest/subscription","commits_url":"https://api.github.com/repos/AltSysrq/proptest/commits{/sha}","git_commits_url":"https://api.github.com/repos/AltSysrq/proptest/git/commits{/sha}","comments_url":"https://api.github.com/repos/AltSysrq/proptest/comments{/number}","issue_comment_url":"https://api.github.com/repos/AltSysrq/proptest/issues/comments{/number}","contents_url":"https://api.github.com/repos/AltSysrq/proptest/contents/{+path}","compare_url":"https://api.github.com/repos/AltSysrq/proptest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AltSysrq/proptest/merges","archive_url":"https://api.github.com/repos/AltSysrq/proptest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AltSysrq/proptest/downloads","issues_url":"https://api.github.com/repos/AltSysrq/proptest/issues{/number}","pulls_url":"https://api.github.com/repos/AltSysrq/proptest/pulls{/number}","milestones_url":"https://api.github.com/repos/AltSysrq/proptest/milestones{/number}","notifications_url":"https://api.github.com/repos/AltSysrq/proptest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AltSysrq/proptest/labels{/name}","releases_url":"https://api.github.com/repos/AltSysrq/proptest/releases{/id}","deployments_url":"https://api.github.com/repos/AltSysrq/proptest/deployments","created_at":"2017-06-18T17:38:03Z","updated_at":"2018-11-06T09:24:58Z","pushed_at":"2018-11-11T21:28:54Z","git_url":"git://github.com/AltSysrq/proptest.git","ssh_url":"git@github.com:AltSysrq/proptest.git","clone_url":"https://github.com/AltSysrq/proptest.git","svn_url":"https://github.com/AltSysrq/proptest","homepage":null,"size":1037,"stargazers_count":272,"watchers_count":272,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":15,"open_issues":24,"watchers":272,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AltSysrq/proptest/pulls/104"},"html":{"href":"https://github.com/AltSysrq/proptest/pull/104"},"issue":{"href":"https://api.github.com/repos/AltSysrq/proptest/issues/104"},"comments":{"href":"https://api.github.com/repos/AltSysrq/proptest/issues/104/comments"},"review_comments":{"href":"https://api.github.com/repos/AltSysrq/proptest/pulls/104/comments"},"review_comment":{"href":"https://api.github.com/repos/AltSysrq/proptest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AltSysrq/proptest/pulls/104/commits"},"statuses":{"href":"https://api.github.com/repos/AltSysrq/proptest/statuses/f87eb87dcb5515a9c9bd85403cf0bfb9ee20b18f"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Centril"}}