diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d330888..ca5bb83 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,7 +19,7 @@ jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - name: Install latest uses: actions-rs/toolchain@v1 with: @@ -31,7 +31,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - name: Install latest uses: actions-rs/toolchain@v1 with: @@ -45,7 +45,7 @@ jobs: clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - name: Install latest uses: actions-rs/toolchain@v1 with: @@ -62,7 +62,7 @@ jobs: runs-on: ubuntu-latest if: github.ref != 'refs/heads/main' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 with: ref: refs/heads/${{ github.head_ref }} persist-credentials: false @@ -98,7 +98,7 @@ jobs: - test - clippy steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -124,7 +124,7 @@ jobs: - test - clippy steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable diff --git a/docs/.rustc_info.json b/docs/.rustc_info.json index 2421181..ad24725 100644 --- a/docs/.rustc_info.json +++ b/docs/.rustc_info.json @@ -1 +1 @@ -{"rustc_fingerprint":13690027882614928059,"outputs":{"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.60.0 (7737e0b5c 2022-04-04)\nbinary: rustc\ncommit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\ncommit-date: 2022-04-04\nhost: x86_64-unknown-linux-gnu\nrelease: 1.60.0\nLLVM version: 14.0.0\n","stderr":""},"2797684049618456168":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"},"5309432699494263626":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n","stderr":""},"931469667778813386":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/runner/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file +{"rustc_fingerprint":3159382573098090533,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.72.0 (5680fa18f 2023-08-23)\nbinary: rustc\ncommit-hash: 5680fa18feaa87f3ff04063800aec256c3d4b4be\ncommit-date: 2023-08-23\nhost: x86_64-unknown-linux-gnu\nrelease: 1.72.0\nLLVM version: 16.0.5\n","stderr":""},"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/runner/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/docs/.rustdoc_fingerprint.json b/docs/.rustdoc_fingerprint.json index 39f4ce4..8dfcda3 100644 --- a/docs/.rustdoc_fingerprint.json +++ b/docs/.rustdoc_fingerprint.json @@ -1 +1 @@ -{"rustc_vv":"rustc 1.60.0 (7737e0b5c 2022-04-04)\nbinary: rustc\ncommit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\ncommit-date: 2022-04-04\nhost: x86_64-unknown-linux-gnu\nrelease: 1.60.0\nLLVM version: 14.0.0\n"} \ No newline at end of file +{"rustc_vv":"rustc 1.72.0 (5680fa18f 2023-08-23)\nbinary: rustc\ncommit-hash: 5680fa18feaa87f3ff04063800aec256c3d4b4be\ncommit-date: 2023-08-23\nhost: x86_64-unknown-linux-gnu\nrelease: 1.72.0\nLLVM version: 16.0.5\n"} \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-1b06897278944c90/run-build-script-build-script-build b/docs/debug/.fingerprint/doc-comment-1b06897278944c90/run-build-script-build-script-build deleted file mode 100644 index 4322295..0000000 --- a/docs/debug/.fingerprint/doc-comment-1b06897278944c90/run-build-script-build-script-build +++ /dev/null @@ -1 +0,0 @@ -4d6870b2301f6e96 \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-1b06897278944c90/run-build-script-build-script-build.json b/docs/debug/.fingerprint/doc-comment-1b06897278944c90/run-build-script-build-script-build.json deleted file mode 100644 index db005a1..0000000 --- a/docs/debug/.fingerprint/doc-comment-1b06897278944c90/run-build-script-build-script-build.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":6064785002308032717,"features":"","target":0,"profile":0,"path":0,"deps":[[3604316984868239912,"build_script_build",false,11046353864905882589]],"local":[{"Precalculated":"0.3.3"}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-bda2383960759dfa/dep-lib-doc_comment b/docs/debug/.fingerprint/doc-comment-49320492121cae83/dep-lib-doc_comment similarity index 100% rename from docs/debug/.fingerprint/doc-comment-bda2383960759dfa/dep-lib-doc_comment rename to docs/debug/.fingerprint/doc-comment-49320492121cae83/dep-lib-doc_comment diff --git a/docs/debug/.fingerprint/doc-comment-ab83651059ca7977/invoked.timestamp b/docs/debug/.fingerprint/doc-comment-49320492121cae83/invoked.timestamp similarity index 100% rename from docs/debug/.fingerprint/doc-comment-ab83651059ca7977/invoked.timestamp rename to docs/debug/.fingerprint/doc-comment-49320492121cae83/invoked.timestamp diff --git a/docs/debug/.fingerprint/doc-comment-49320492121cae83/lib-doc_comment b/docs/debug/.fingerprint/doc-comment-49320492121cae83/lib-doc_comment new file mode 100644 index 0000000..e81e24b --- /dev/null +++ b/docs/debug/.fingerprint/doc-comment-49320492121cae83/lib-doc_comment @@ -0,0 +1 @@ +3ebd604780b6e01f \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-49320492121cae83/lib-doc_comment.json b/docs/debug/.fingerprint/doc-comment-49320492121cae83/lib-doc_comment.json new file mode 100644 index 0000000..ccb6d78 --- /dev/null +++ b/docs/debug/.fingerprint/doc-comment-49320492121cae83/lib-doc_comment.json @@ -0,0 +1 @@ +{"rustc":17954901377634971088,"features":"[]","target":13977519194929735499,"profile":14473208297124147686,"path":12194825529008265702,"deps":[[3604316984868239912,"build_script_build",false,14440805965209185697]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/doc-comment-49320492121cae83/dep-lib-doc_comment"}}],"rustflags":[],"metadata":2009847191618272438,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-ab83651059ca7977/build-script-build-script-build b/docs/debug/.fingerprint/doc-comment-ab83651059ca7977/build-script-build-script-build deleted file mode 100644 index 1d7c0b0..0000000 --- a/docs/debug/.fingerprint/doc-comment-ab83651059ca7977/build-script-build-script-build +++ /dev/null @@ -1 +0,0 @@ -dd7bfa6450884c99 \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-ab83651059ca7977/build-script-build-script-build.json b/docs/debug/.fingerprint/doc-comment-ab83651059ca7977/build-script-build-script-build.json deleted file mode 100644 index 88c66cc..0000000 --- a/docs/debug/.fingerprint/doc-comment-ab83651059ca7977/build-script-build-script-build.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":6064785002308032717,"features":"[]","target":2709041430195671023,"profile":12637318739757120569,"path":6418153070291560974,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/doc-comment-ab83651059ca7977/dep-build-script-build-script-build"}}],"rustflags":[],"metadata":2009847191618272438,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-bda2383960759dfa/lib-doc_comment b/docs/debug/.fingerprint/doc-comment-bda2383960759dfa/lib-doc_comment deleted file mode 100644 index 7df5a2d..0000000 --- a/docs/debug/.fingerprint/doc-comment-bda2383960759dfa/lib-doc_comment +++ /dev/null @@ -1 +0,0 @@ -29b51fa956307754 \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-bda2383960759dfa/lib-doc_comment.json b/docs/debug/.fingerprint/doc-comment-bda2383960759dfa/lib-doc_comment.json deleted file mode 100644 index b8e3148..0000000 --- a/docs/debug/.fingerprint/doc-comment-bda2383960759dfa/lib-doc_comment.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":6064785002308032717,"features":"[]","target":3927201586341892043,"profile":3735503092003429423,"path":9436458717181895228,"deps":[[3604316984868239912,"build_script_build",false,10839635647139965005]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/doc-comment-bda2383960759dfa/dep-lib-doc_comment"}}],"rustflags":[],"metadata":2009847191618272438,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-f21abc208f163460/run-build-script-build-script-build b/docs/debug/.fingerprint/doc-comment-f21abc208f163460/run-build-script-build-script-build new file mode 100644 index 0000000..49c0a6a --- /dev/null +++ b/docs/debug/.fingerprint/doc-comment-f21abc208f163460/run-build-script-build-script-build @@ -0,0 +1 @@ +a1ada2c2830c68c8 \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-f21abc208f163460/run-build-script-build-script-build.json b/docs/debug/.fingerprint/doc-comment-f21abc208f163460/run-build-script-build-script-build.json new file mode 100644 index 0000000..955c23e --- /dev/null +++ b/docs/debug/.fingerprint/doc-comment-f21abc208f163460/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":17954901377634971088,"features":"","target":0,"profile":0,"path":0,"deps":[[3604316984868239912,"build_script_build",false,2200569816358746873]],"local":[{"Precalculated":"0.3.3"}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/build-script-build-script-build b/docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/build-script-build-script-build new file mode 100644 index 0000000..ab0b5da --- /dev/null +++ b/docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/build-script-build-script-build @@ -0,0 +1 @@ +f97a82bf96fe891e \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/build-script-build-script-build.json b/docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/build-script-build-script-build.json new file mode 100644 index 0000000..52077f4 --- /dev/null +++ b/docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":17954901377634971088,"features":"[]","target":8188216131759486267,"profile":13178609178403335023,"path":17252156501066694336,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/doc-comment-ffd15a95ae96471a/dep-build-script-build-script-build"}}],"rustflags":[],"metadata":2009847191618272438,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/doc-comment-ab83651059ca7977/dep-build-script-build-script-build b/docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/dep-build-script-build-script-build similarity index 100% rename from docs/debug/.fingerprint/doc-comment-ab83651059ca7977/dep-build-script-build-script-build rename to docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/dep-build-script-build-script-build diff --git a/docs/debug/.fingerprint/doc-comment-bda2383960759dfa/invoked.timestamp b/docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/invoked.timestamp similarity index 100% rename from docs/debug/.fingerprint/doc-comment-bda2383960759dfa/invoked.timestamp rename to docs/debug/.fingerprint/doc-comment-ffd15a95ae96471a/invoked.timestamp diff --git a/docs/debug/.fingerprint/paste-03000d454419338b/run-build-script-build-script-build b/docs/debug/.fingerprint/paste-03000d454419338b/run-build-script-build-script-build new file mode 100644 index 0000000..abf6d2f --- /dev/null +++ b/docs/debug/.fingerprint/paste-03000d454419338b/run-build-script-build-script-build @@ -0,0 +1 @@ +afeaa3d5b221f169 \ No newline at end of file diff --git a/docs/debug/.fingerprint/paste-03000d454419338b/run-build-script-build-script-build.json b/docs/debug/.fingerprint/paste-03000d454419338b/run-build-script-build-script-build.json new file mode 100644 index 0000000..4bc7121 --- /dev/null +++ b/docs/debug/.fingerprint/paste-03000d454419338b/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":17954901377634971088,"features":"","target":0,"profile":0,"path":0,"deps":[[15340987198089805406,"build_script_build",false,4012564592001164875]],"local":[{"RerunIfChanged":{"output":"debug/build/paste-03000d454419338b/output","paths":["build.rs"]}}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/lib-paste b/docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/lib-paste deleted file mode 100644 index a8289e9..0000000 --- a/docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/lib-paste +++ /dev/null @@ -1 +0,0 @@ -5190ddf878d108e5 \ No newline at end of file diff --git a/docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/lib-paste.json b/docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/lib-paste.json deleted file mode 100644 index 8e08d12..0000000 --- a/docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/lib-paste.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":6064785002308032717,"features":"[]","target":11680813067107455742,"profile":12637318739757120569,"path":6270110714609130184,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/paste-20ebc6fd9e2b3438/dep-lib-paste"}}],"rustflags":[],"metadata":13015013502493569352,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/dep-lib-paste b/docs/debug/.fingerprint/paste-3438d5d70193e9e2/dep-lib-paste similarity index 100% rename from docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/dep-lib-paste rename to docs/debug/.fingerprint/paste-3438d5d70193e9e2/dep-lib-paste diff --git a/docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/invoked.timestamp b/docs/debug/.fingerprint/paste-3438d5d70193e9e2/invoked.timestamp similarity index 100% rename from docs/debug/.fingerprint/paste-20ebc6fd9e2b3438/invoked.timestamp rename to docs/debug/.fingerprint/paste-3438d5d70193e9e2/invoked.timestamp diff --git a/docs/debug/.fingerprint/paste-3438d5d70193e9e2/lib-paste b/docs/debug/.fingerprint/paste-3438d5d70193e9e2/lib-paste new file mode 100644 index 0000000..3fe8f00 --- /dev/null +++ b/docs/debug/.fingerprint/paste-3438d5d70193e9e2/lib-paste @@ -0,0 +1 @@ +0c713dc59e607477 \ No newline at end of file diff --git a/docs/debug/.fingerprint/paste-3438d5d70193e9e2/lib-paste.json b/docs/debug/.fingerprint/paste-3438d5d70193e9e2/lib-paste.json new file mode 100644 index 0000000..3e04c6c --- /dev/null +++ b/docs/debug/.fingerprint/paste-3438d5d70193e9e2/lib-paste.json @@ -0,0 +1 @@ +{"rustc":17954901377634971088,"features":"[]","target":16353436600926080501,"profile":13178609178403335023,"path":14358474520932413063,"deps":[[15340987198089805406,"build_script_build",false,7633919895341886127]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/paste-3438d5d70193e9e2/dep-lib-paste"}}],"rustflags":[],"metadata":13015013502493569352,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/paste-933be25a5ccab2fd/build-script-build-script-build b/docs/debug/.fingerprint/paste-933be25a5ccab2fd/build-script-build-script-build new file mode 100644 index 0000000..69ecc51 --- /dev/null +++ b/docs/debug/.fingerprint/paste-933be25a5ccab2fd/build-script-build-script-build @@ -0,0 +1 @@ +4b268aa83c7eaf37 \ No newline at end of file diff --git a/docs/debug/.fingerprint/paste-933be25a5ccab2fd/build-script-build-script-build.json b/docs/debug/.fingerprint/paste-933be25a5ccab2fd/build-script-build-script-build.json new file mode 100644 index 0000000..60c9da2 --- /dev/null +++ b/docs/debug/.fingerprint/paste-933be25a5ccab2fd/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":17954901377634971088,"features":"[]","target":2297296889237502566,"profile":13178609178403335023,"path":13953737244675886376,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/paste-933be25a5ccab2fd/dep-build-script-build-script-build"}}],"rustflags":[],"metadata":13015013502493569352,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/dep-lib-safe-transmute b/docs/debug/.fingerprint/paste-933be25a5ccab2fd/dep-build-script-build-script-build similarity index 100% rename from docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/dep-lib-safe-transmute rename to docs/debug/.fingerprint/paste-933be25a5ccab2fd/dep-build-script-build-script-build diff --git a/docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/invoked.timestamp b/docs/debug/.fingerprint/paste-933be25a5ccab2fd/invoked.timestamp similarity index 100% rename from docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/invoked.timestamp rename to docs/debug/.fingerprint/paste-933be25a5ccab2fd/invoked.timestamp diff --git a/docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/lib-safe-transmute b/docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/lib-safe-transmute deleted file mode 100644 index 4ae79fd..0000000 --- a/docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/lib-safe-transmute +++ /dev/null @@ -1 +0,0 @@ -20d79b6bd636334e \ No newline at end of file diff --git a/docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/lib-safe-transmute.json b/docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/lib-safe-transmute.json deleted file mode 100644 index 79adf8a..0000000 --- a/docs/debug/.fingerprint/safe-transmute-08de2e97acce0a0b/lib-safe-transmute.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":6064785002308032717,"features":"[\"alloc\", \"default\", \"std\"]","target":53543228631905795,"profile":3735503092003429423,"path":3574858853815873827,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/safe-transmute-08de2e97acce0a0b/dep-lib-safe-transmute"}}],"rustflags":[],"metadata":1405137643048346262,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/dep-lib-safe-transmute b/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/dep-lib-safe-transmute new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/dep-lib-safe-transmute differ diff --git a/docs/debug/build/doc-comment-1b06897278944c90/invoked.timestamp b/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/invoked.timestamp similarity index 100% rename from docs/debug/build/doc-comment-1b06897278944c90/invoked.timestamp rename to docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/invoked.timestamp diff --git a/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/lib-safe-transmute b/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/lib-safe-transmute new file mode 100644 index 0000000..e8a247e --- /dev/null +++ b/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/lib-safe-transmute @@ -0,0 +1 @@ +60a5601e659f5a3d \ No newline at end of file diff --git a/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/lib-safe-transmute.json b/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/lib-safe-transmute.json new file mode 100644 index 0000000..a12168d --- /dev/null +++ b/docs/debug/.fingerprint/safe-transmute-95c3998b024316fe/lib-safe-transmute.json @@ -0,0 +1 @@ +{"rustc":17954901377634971088,"features":"[\"alloc\", \"default\", \"std\"]","target":3916664945231048275,"profile":14473208297124147686,"path":8197205610629558026,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/safe-transmute-95c3998b024316fe/dep-lib-safe-transmute"}}],"rustflags":[],"metadata":1405137643048346262,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/ubits-5a1a070a8a6eaa8e/doc-lib-ubits b/docs/debug/.fingerprint/ubits-5a1a070a8a6eaa8e/doc-lib-ubits new file mode 100644 index 0000000..00929d0 --- /dev/null +++ b/docs/debug/.fingerprint/ubits-5a1a070a8a6eaa8e/doc-lib-ubits @@ -0,0 +1 @@ +3aac76167c17c6c7 \ No newline at end of file diff --git a/docs/debug/.fingerprint/ubits-5a1a070a8a6eaa8e/doc-lib-ubits.json b/docs/debug/.fingerprint/ubits-5a1a070a8a6eaa8e/doc-lib-ubits.json new file mode 100644 index 0000000..3594a28 --- /dev/null +++ b/docs/debug/.fingerprint/ubits-5a1a070a8a6eaa8e/doc-lib-ubits.json @@ -0,0 +1 @@ +{"rustc":17954901377634971088,"features":"[]","target":8165669218380602157,"profile":1722418203641614240,"path":17523903030608720598,"deps":[[3604316984868239912,"doc_comment",false,2297036472028544318],[15340987198089805406,"paste",false,8607611022842097932],[17122623820282837837,"safe_transmute",false,4421021240867726688]],"local":[{"Precalculated":"1693832771.188925062s (docs/.rustc_info.json)"}],"rustflags":[],"metadata":3531897852417656932,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/.fingerprint/ubits-5cb737df32df7532/doc-lib-ubits b/docs/debug/.fingerprint/ubits-5cb737df32df7532/doc-lib-ubits deleted file mode 100644 index c71b050..0000000 --- a/docs/debug/.fingerprint/ubits-5cb737df32df7532/doc-lib-ubits +++ /dev/null @@ -1 +0,0 @@ -0557fa1f5a0f2882 \ No newline at end of file diff --git a/docs/debug/.fingerprint/ubits-5cb737df32df7532/doc-lib-ubits.json b/docs/debug/.fingerprint/ubits-5cb737df32df7532/doc-lib-ubits.json deleted file mode 100644 index cf264ed..0000000 --- a/docs/debug/.fingerprint/ubits-5cb737df32df7532/doc-lib-ubits.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":6064785002308032717,"features":"[]","target":2709273923335524737,"profile":13883289224548942237,"path":17523903030608720598,"deps":[[3604316984868239912,"doc_comment",false,6086386570177262889],[17122623820282837837,"safe_transmute",false,5634907853326898976],[17738545360000146463,"paste",false,16503671152000733265]],"local":[{"Precalculated":"1651601534.138340045s (docs/.rustc_info.json)"}],"rustflags":[],"metadata":3531897852417656932,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/docs/debug/build/doc-comment-1b06897278944c90/root-output b/docs/debug/build/doc-comment-1b06897278944c90/root-output deleted file mode 100644 index be44112..0000000 --- a/docs/debug/build/doc-comment-1b06897278944c90/root-output +++ /dev/null @@ -1 +0,0 @@ -/home/runner/work/ubits/ubits/docs/debug/build/doc-comment-1b06897278944c90/out \ No newline at end of file diff --git a/docs/debug/build/doc-comment-ab83651059ca7977/build-script-build b/docs/debug/build/doc-comment-ab83651059ca7977/build-script-build deleted file mode 100755 index ff6382a..0000000 Binary files a/docs/debug/build/doc-comment-ab83651059ca7977/build-script-build and /dev/null differ diff --git a/docs/debug/build/doc-comment-ab83651059ca7977/build_script_build-ab83651059ca7977 b/docs/debug/build/doc-comment-ab83651059ca7977/build_script_build-ab83651059ca7977 deleted file mode 100755 index ff6382a..0000000 Binary files a/docs/debug/build/doc-comment-ab83651059ca7977/build_script_build-ab83651059ca7977 and /dev/null differ diff --git a/docs/debug/build/doc-comment-ab83651059ca7977/build_script_build-ab83651059ca7977.d b/docs/debug/build/doc-comment-ab83651059ca7977/build_script_build-ab83651059ca7977.d deleted file mode 100644 index db88898..0000000 --- a/docs/debug/build/doc-comment-ab83651059ca7977/build_script_build-ab83651059ca7977.d +++ /dev/null @@ -1,5 +0,0 @@ -/home/runner/work/ubits/ubits/docs/debug/build/doc-comment-ab83651059ca7977/build_script_build-ab83651059ca7977: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/doc-comment-0.3.3/build.rs - -/home/runner/work/ubits/ubits/docs/debug/build/doc-comment-ab83651059ca7977/build_script_build-ab83651059ca7977.d: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/doc-comment-0.3.3/build.rs - -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/doc-comment-0.3.3/build.rs: diff --git a/docs/debug/build/doc-comment-f21abc208f163460/invoked.timestamp b/docs/debug/build/doc-comment-f21abc208f163460/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/docs/debug/build/doc-comment-f21abc208f163460/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/docs/debug/build/doc-comment-1b06897278944c90/output b/docs/debug/build/doc-comment-f21abc208f163460/output similarity index 100% rename from docs/debug/build/doc-comment-1b06897278944c90/output rename to docs/debug/build/doc-comment-f21abc208f163460/output diff --git a/docs/debug/build/doc-comment-f21abc208f163460/root-output b/docs/debug/build/doc-comment-f21abc208f163460/root-output new file mode 100644 index 0000000..e7fc1d4 --- /dev/null +++ b/docs/debug/build/doc-comment-f21abc208f163460/root-output @@ -0,0 +1 @@ +/home/runner/work/ubits/ubits/docs/debug/build/doc-comment-f21abc208f163460/out \ No newline at end of file diff --git a/docs/debug/build/doc-comment-1b06897278944c90/stderr b/docs/debug/build/doc-comment-f21abc208f163460/stderr similarity index 100% rename from docs/debug/build/doc-comment-1b06897278944c90/stderr rename to docs/debug/build/doc-comment-f21abc208f163460/stderr diff --git a/docs/debug/build/doc-comment-ffd15a95ae96471a/build-script-build b/docs/debug/build/doc-comment-ffd15a95ae96471a/build-script-build new file mode 100755 index 0000000..7dc852a Binary files /dev/null and b/docs/debug/build/doc-comment-ffd15a95ae96471a/build-script-build differ diff --git a/docs/debug/build/doc-comment-ffd15a95ae96471a/build_script_build-ffd15a95ae96471a b/docs/debug/build/doc-comment-ffd15a95ae96471a/build_script_build-ffd15a95ae96471a new file mode 100755 index 0000000..7dc852a Binary files /dev/null and b/docs/debug/build/doc-comment-ffd15a95ae96471a/build_script_build-ffd15a95ae96471a differ diff --git a/docs/debug/build/doc-comment-ffd15a95ae96471a/build_script_build-ffd15a95ae96471a.d b/docs/debug/build/doc-comment-ffd15a95ae96471a/build_script_build-ffd15a95ae96471a.d new file mode 100644 index 0000000..734c8b0 --- /dev/null +++ b/docs/debug/build/doc-comment-ffd15a95ae96471a/build_script_build-ffd15a95ae96471a.d @@ -0,0 +1,5 @@ +/home/runner/work/ubits/ubits/docs/debug/build/doc-comment-ffd15a95ae96471a/build_script_build-ffd15a95ae96471a: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/doc-comment-0.3.3/build.rs + +/home/runner/work/ubits/ubits/docs/debug/build/doc-comment-ffd15a95ae96471a/build_script_build-ffd15a95ae96471a.d: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/doc-comment-0.3.3/build.rs + +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/doc-comment-0.3.3/build.rs: diff --git a/docs/debug/build/paste-03000d454419338b/invoked.timestamp b/docs/debug/build/paste-03000d454419338b/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/docs/debug/build/paste-03000d454419338b/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/docs/debug/build/paste-03000d454419338b/output b/docs/debug/build/paste-03000d454419338b/output new file mode 100644 index 0000000..d15ba9a --- /dev/null +++ b/docs/debug/build/paste-03000d454419338b/output @@ -0,0 +1 @@ +cargo:rerun-if-changed=build.rs diff --git a/docs/debug/build/paste-03000d454419338b/root-output b/docs/debug/build/paste-03000d454419338b/root-output new file mode 100644 index 0000000..d1463e8 --- /dev/null +++ b/docs/debug/build/paste-03000d454419338b/root-output @@ -0,0 +1 @@ +/home/runner/work/ubits/ubits/docs/debug/build/paste-03000d454419338b/out \ No newline at end of file diff --git a/docs/debug/build/paste-03000d454419338b/stderr b/docs/debug/build/paste-03000d454419338b/stderr new file mode 100644 index 0000000..e69de29 diff --git a/docs/debug/build/paste-933be25a5ccab2fd/build-script-build b/docs/debug/build/paste-933be25a5ccab2fd/build-script-build new file mode 100755 index 0000000..6be88b2 Binary files /dev/null and b/docs/debug/build/paste-933be25a5ccab2fd/build-script-build differ diff --git a/docs/debug/build/paste-933be25a5ccab2fd/build_script_build-933be25a5ccab2fd b/docs/debug/build/paste-933be25a5ccab2fd/build_script_build-933be25a5ccab2fd new file mode 100755 index 0000000..6be88b2 Binary files /dev/null and b/docs/debug/build/paste-933be25a5ccab2fd/build_script_build-933be25a5ccab2fd differ diff --git a/docs/debug/build/paste-933be25a5ccab2fd/build_script_build-933be25a5ccab2fd.d b/docs/debug/build/paste-933be25a5ccab2fd/build_script_build-933be25a5ccab2fd.d new file mode 100644 index 0000000..21beeb0 --- /dev/null +++ b/docs/debug/build/paste-933be25a5ccab2fd/build_script_build-933be25a5ccab2fd.d @@ -0,0 +1,5 @@ +/home/runner/work/ubits/ubits/docs/debug/build/paste-933be25a5ccab2fd/build_script_build-933be25a5ccab2fd: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/build.rs + +/home/runner/work/ubits/ubits/docs/debug/build/paste-933be25a5ccab2fd/build_script_build-933be25a5ccab2fd.d: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/build.rs + +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/build.rs: diff --git a/docs/debug/deps/doc_comment-49320492121cae83.d b/docs/debug/deps/doc_comment-49320492121cae83.d new file mode 100644 index 0000000..1a358b5 --- /dev/null +++ b/docs/debug/deps/doc_comment-49320492121cae83.d @@ -0,0 +1,5 @@ +/home/runner/work/ubits/ubits/docs/debug/deps/doc_comment-49320492121cae83.rmeta: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/doc-comment-0.3.3/src/lib.rs + +/home/runner/work/ubits/ubits/docs/debug/deps/doc_comment-49320492121cae83.d: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/doc-comment-0.3.3/src/lib.rs + +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/doc-comment-0.3.3/src/lib.rs: diff --git a/docs/debug/deps/doc_comment-bda2383960759dfa.d b/docs/debug/deps/doc_comment-bda2383960759dfa.d deleted file mode 100644 index 18aff55..0000000 --- a/docs/debug/deps/doc_comment-bda2383960759dfa.d +++ /dev/null @@ -1,5 +0,0 @@ -/home/runner/work/ubits/ubits/docs/debug/deps/doc_comment-bda2383960759dfa.rmeta: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/doc-comment-0.3.3/src/lib.rs - -/home/runner/work/ubits/ubits/docs/debug/deps/doc_comment-bda2383960759dfa.d: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/doc-comment-0.3.3/src/lib.rs - -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/doc-comment-0.3.3/src/lib.rs: diff --git a/docs/debug/deps/libdoc_comment-49320492121cae83.rmeta b/docs/debug/deps/libdoc_comment-49320492121cae83.rmeta new file mode 100644 index 0000000..3c7eed8 Binary files /dev/null and b/docs/debug/deps/libdoc_comment-49320492121cae83.rmeta differ diff --git a/docs/debug/deps/libdoc_comment-bda2383960759dfa.rmeta b/docs/debug/deps/libdoc_comment-bda2383960759dfa.rmeta deleted file mode 100644 index 8db8898..0000000 Binary files a/docs/debug/deps/libdoc_comment-bda2383960759dfa.rmeta and /dev/null differ diff --git a/docs/debug/deps/libpaste-20ebc6fd9e2b3438.so b/docs/debug/deps/libpaste-20ebc6fd9e2b3438.so deleted file mode 100755 index 9174acb..0000000 Binary files a/docs/debug/deps/libpaste-20ebc6fd9e2b3438.so and /dev/null differ diff --git a/docs/debug/deps/libpaste-3438d5d70193e9e2.so b/docs/debug/deps/libpaste-3438d5d70193e9e2.so new file mode 100755 index 0000000..0b1b197 Binary files /dev/null and b/docs/debug/deps/libpaste-3438d5d70193e9e2.so differ diff --git a/docs/debug/deps/libsafe_transmute-08de2e97acce0a0b.rmeta b/docs/debug/deps/libsafe_transmute-08de2e97acce0a0b.rmeta deleted file mode 100644 index 7d977c9..0000000 Binary files a/docs/debug/deps/libsafe_transmute-08de2e97acce0a0b.rmeta and /dev/null differ diff --git a/docs/debug/deps/libsafe_transmute-95c3998b024316fe.rmeta b/docs/debug/deps/libsafe_transmute-95c3998b024316fe.rmeta new file mode 100644 index 0000000..e317ce1 Binary files /dev/null and b/docs/debug/deps/libsafe_transmute-95c3998b024316fe.rmeta differ diff --git a/docs/debug/deps/paste-20ebc6fd9e2b3438.d b/docs/debug/deps/paste-20ebc6fd9e2b3438.d deleted file mode 100644 index a09ff59..0000000 --- a/docs/debug/deps/paste-20ebc6fd9e2b3438.d +++ /dev/null @@ -1,8 +0,0 @@ -/home/runner/work/ubits/ubits/docs/debug/deps/libpaste-20ebc6fd9e2b3438.so: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/lib.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/attr.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/error.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/segment.rs - -/home/runner/work/ubits/ubits/docs/debug/deps/paste-20ebc6fd9e2b3438.d: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/lib.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/attr.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/error.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/segment.rs - -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/lib.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/attr.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/error.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/paste-1.0.7/src/segment.rs: diff --git a/docs/debug/deps/paste-3438d5d70193e9e2.d b/docs/debug/deps/paste-3438d5d70193e9e2.d new file mode 100644 index 0000000..59aa12a --- /dev/null +++ b/docs/debug/deps/paste-3438d5d70193e9e2.d @@ -0,0 +1,8 @@ +/home/runner/work/ubits/ubits/docs/debug/deps/libpaste-3438d5d70193e9e2.so: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/lib.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/attr.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/error.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/segment.rs + +/home/runner/work/ubits/ubits/docs/debug/deps/paste-3438d5d70193e9e2.d: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/lib.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/attr.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/error.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/segment.rs + +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/lib.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/attr.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/error.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/paste-1.0.14/src/segment.rs: diff --git a/docs/debug/deps/safe_transmute-08de2e97acce0a0b.d b/docs/debug/deps/safe_transmute-08de2e97acce0a0b.d deleted file mode 100644 index 5850e3c..0000000 --- a/docs/debug/deps/safe_transmute-08de2e97acce0a0b.d +++ /dev/null @@ -1,16 +0,0 @@ -/home/runner/work/ubits/ubits/docs/debug/deps/safe_transmute-08de2e97acce0a0b.rmeta: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/lib.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/full.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/base.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/bool.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/util.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/align.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/error.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/guard.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/trivial.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/to_bytes.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/migration/mod.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/migration/v0_11.rs - -/home/runner/work/ubits/ubits/docs/debug/deps/safe_transmute-08de2e97acce0a0b.d: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/lib.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/full.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/base.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/bool.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/util.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/align.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/error.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/guard.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/trivial.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/to_bytes.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/migration/mod.rs /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/migration/v0_11.rs - -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/lib.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/full.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/base.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/bool.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/util.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/align.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/error.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/guard.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/trivial.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/to_bytes.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/migration/mod.rs: -/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/safe-transmute-0.11.2/src/migration/v0_11.rs: diff --git a/docs/debug/deps/safe_transmute-95c3998b024316fe.d b/docs/debug/deps/safe_transmute-95c3998b024316fe.d new file mode 100644 index 0000000..266e92c --- /dev/null +++ b/docs/debug/deps/safe_transmute-95c3998b024316fe.d @@ -0,0 +1,16 @@ +/home/runner/work/ubits/ubits/docs/debug/deps/safe_transmute-95c3998b024316fe.rmeta: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/lib.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/full.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/base.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/bool.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/util.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/align.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/error.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/guard.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/trivial.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/to_bytes.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/migration/mod.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/migration/v0_11.rs + +/home/runner/work/ubits/ubits/docs/debug/deps/safe_transmute-95c3998b024316fe.d: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/lib.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/full.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/base.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/bool.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/util.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/align.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/error.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/guard.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/trivial.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/to_bytes.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/migration/mod.rs /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/migration/v0_11.rs + +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/lib.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/full.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/base.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/bool.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/util.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/align.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/error.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/guard.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/trivial.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/to_bytes.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/migration/mod.rs: +/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/safe-transmute-0.11.2/src/migration/v0_11.rs: diff --git a/docs/doc/.lock b/docs/doc/.lock old mode 100755 new mode 100644 diff --git a/docs/doc/FiraSans-Medium.woff b/docs/doc/FiraSans-Medium.woff deleted file mode 100644 index 7d742c5..0000000 Binary files a/docs/doc/FiraSans-Medium.woff and /dev/null differ diff --git a/docs/doc/FiraSans-Regular.woff b/docs/doc/FiraSans-Regular.woff deleted file mode 100644 index d8e0363..0000000 Binary files a/docs/doc/FiraSans-Regular.woff and /dev/null differ diff --git a/docs/doc/NanumBarunGothic.ttf.woff b/docs/doc/NanumBarunGothic.ttf.woff deleted file mode 100644 index fb063e8..0000000 Binary files a/docs/doc/NanumBarunGothic.ttf.woff and /dev/null differ diff --git a/docs/doc/SourceCodePro-It.ttf.woff b/docs/doc/SourceCodePro-It.ttf.woff deleted file mode 100644 index 8d68f2f..0000000 Binary files a/docs/doc/SourceCodePro-It.ttf.woff and /dev/null differ diff --git a/docs/doc/SourceCodePro-Regular.ttf.woff b/docs/doc/SourceCodePro-Regular.ttf.woff deleted file mode 100644 index 7be076e..0000000 Binary files a/docs/doc/SourceCodePro-Regular.ttf.woff and /dev/null differ diff --git a/docs/doc/SourceCodePro-Semibold.ttf.woff b/docs/doc/SourceCodePro-Semibold.ttf.woff deleted file mode 100644 index 61bc67b..0000000 Binary files a/docs/doc/SourceCodePro-Semibold.ttf.woff and /dev/null differ diff --git a/docs/doc/SourceSerif4-Bold.ttf.woff b/docs/doc/SourceSerif4-Bold.ttf.woff deleted file mode 100644 index 8ad4188..0000000 Binary files a/docs/doc/SourceSerif4-Bold.ttf.woff and /dev/null differ diff --git a/docs/doc/SourceSerif4-Bold.ttf.woff2 b/docs/doc/SourceSerif4-Bold.ttf.woff2 deleted file mode 100644 index db57d21..0000000 Binary files a/docs/doc/SourceSerif4-Bold.ttf.woff2 and /dev/null differ diff --git a/docs/doc/SourceSerif4-It.ttf.woff b/docs/doc/SourceSerif4-It.ttf.woff deleted file mode 100644 index 2a34b5c..0000000 Binary files a/docs/doc/SourceSerif4-It.ttf.woff and /dev/null differ diff --git a/docs/doc/SourceSerif4-It.ttf.woff2 b/docs/doc/SourceSerif4-It.ttf.woff2 deleted file mode 100644 index 1cbc021..0000000 Binary files a/docs/doc/SourceSerif4-It.ttf.woff2 and /dev/null differ diff --git a/docs/doc/SourceSerif4-Regular.ttf.woff b/docs/doc/SourceSerif4-Regular.ttf.woff deleted file mode 100644 index 45a5521..0000000 Binary files a/docs/doc/SourceSerif4-Regular.ttf.woff and /dev/null differ diff --git a/docs/doc/SourceSerif4-Regular.ttf.woff2 b/docs/doc/SourceSerif4-Regular.ttf.woff2 deleted file mode 100644 index 2db73fe..0000000 Binary files a/docs/doc/SourceSerif4-Regular.ttf.woff2 and /dev/null differ diff --git a/docs/doc/ayu.css b/docs/doc/ayu.css deleted file mode 100644 index 50d893e..0000000 --- a/docs/doc/ayu.css +++ /dev/null @@ -1 +0,0 @@ - body{background-color:#0f1419;color:#c5c5c5;}h1,h2,h3,h4{color:white;}h1.fqn{border-bottom-color:#5c6773;}h1.fqn a{color:#fff;}h2,h3,h4{border-bottom-color:#5c6773;}h4{border:none;}.in-band{background-color:#0f1419;}.invisible{background:rgba(0,0,0,0);}.docblock code{color:#ffb454;}.code-header{color:#e6e1cf;}.docblock pre>code,pre>code{color:#e6e1cf;}span code{color:#e6e1cf;}.docblock a>code{color:#39AFD7 !important;}.docblock code,.docblock-short code{background-color:#191f26;}pre,.rustdoc.source .example-wrap{color:#e6e1cf;background-color:#191f26;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:#14191f;}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);}*{scrollbar-color:#5c6773 #24292f;}.sidebar{scrollbar-color:#5c6773 #24292f;}::-webkit-scrollbar-track{background-color:transparent;}::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar::-webkit-scrollbar-track{background-color:transparent;}.sidebar::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar .current,.sidebar a:hover{background-color:transparent;color:#ffb44c;}.source .sidebar{background-color:#14191f;}.sidebar-elems .location{color:#ff7733;}.line-numbers span{color:#5c6773;}.line-numbers .line-highlighted{color:#708090;background-color:rgba(255,236,164,0.06);padding-right:4px;border-right:1px solid #ffb44c;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:#5c6773;}.docblock table td,.docblock table th{border-color:#5c6773;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#c5c5c5;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#000 !important;background-color:#c6afb3;}.search-results a{color:#0096cf;}.search-results a div.desc{color:#c5c5c5;}.content .item-info::before{color:#ccc;}.content span.foreigntype,.content a.foreigntype{color:#ffa0a5;}.content span.union,.content a.union{color:#ffa0a5;}.content span.constant,.content a.constant,.content span.static,.content a.static{color:#39AFD7;}.content span.primitive,.content a.primitive{color:#ffa0a5;}.content span.traitalias,.content a.traitalias{color:#39AFD7;}.content span.keyword,.content a.keyword{color:#39AFD7;}.content span.externcrate,.content span.mod,.content a.mod{color:#39AFD7;}.content span.struct,.content a.struct{color:#ffa0a5;}.content span.enum,.content a.enum{color:#ffa0a5;}.content span.trait,.content a.trait{color:#39AFD7;}.content span.type,.content a.type{color:#39AFD7;}.content span.type,.content a.type,.block a.current.type{color:#39AFD7;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#39AFD7;}.content span.fn,.content a.fn,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod,.content .fnname{color:#fdd687;}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:#a37acc;}.sidebar a{color:#53b1db;}.sidebar a.current.type{color:#53b1db;}.sidebar a.current.associatedtype{color:#53b1db;}pre.rust .comment{color:#788797;}pre.rust .doccomment{color:#a1ac88;}nav.main .current{border-top-color:#5c6773;border-bottom-color:#5c6773;}nav.main .separator{border:1px solid #5c6773;}a{color:#39AFD7;}a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a{color:#c5c5c5;}.sidebar h2 a,.sidebar h3 a{color:white;}.search-results a{color:#0096cf;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search,.search-input{background-color:#141920;border-color:#424c57;color:#c5c5c5;}.search-input{color:#ffffff;}.module-item .stab,.import-item .stab{color:#000;}.stab.unstable,.stab.deprecated,.stab.portability{color:#c5c5c5;background:#314559 !important;border-style:none !important;border-radius:4px;padding:3px 6px 3px 6px;}.stab.portability>code{color:#e6e1cf;background:none;}#help>div{background:#14191f;box-shadow:0px 6px 20px 0px black;border:none;border-radius:4px;}#help span.bottom,#help span.top{border-color:#5c6773;}.rightside,.out-of-band{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#788797;}.line-numbers :target{background-color:transparent;}pre.rust .number,pre.rust .string{color:#b8cc52;}pre.rust .kw,pre.rust .kw-2,pre.rust .prelude-ty,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .op,pre.rust .lifetime{color:#ff7733;}pre.rust .macro,pre.rust .macro-nonterminal{color:#a37acc;}pre.rust .question-mark{color:#ff9011;}pre.rust .self{color:#36a3d9;font-style:italic;}pre.rust .attribute{color:#e6e1cf;}pre.rust .attribute .ident,pre.rust .attribute .op{color:#e6e1cf;}.example-wrap>pre.line-number{color:#5c67736e;border:none;}a.test-arrow{font-size:100%;color:#788797;border-radius:4px;background-color:rgba(57,175,215,0.09);}a.test-arrow:hover{background-color:rgba(57,175,215,0.368);color:#c5c5c5;}.toggle-label,.code-attribute{color:#999;}:target{background:rgba(255,236,164,0.06);border-right:3px solid rgba(255,180,76,0.85);}pre.compile_fail{border-left:2px solid rgba(255,0,0,.4);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.4);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#39AFD7;}.tooltip::after{background-color:#314559;color:#c5c5c5;border:1px solid #5c6773;}.tooltip::before{border-color:transparent #314559 transparent transparent;}.notable-traits-tooltiptext{background-color:#314559;border-color:#5c6773;}.notable-traits-tooltiptext .notable{border-bottom-color:#5c6773;}#titles>button.selected{background-color:#141920 !important;border-bottom:1px solid #ffb44c !important;border-top:none;}#titles>button:not(.selected){background-color:transparent !important;border:none;}#titles>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#titles>button>div.count{color:#888;}.search-input:focus{}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{}.content span.struct,.content a.struct,.block a.current.struct{}#titles>button:hover,#titles>button.selected{}.content span.typedef,.content a.typedef,.block a.current.typedef{}.content span.union,.content a.union,.block a.current.union{}pre.rust .lifetime{}.stab.unstable{}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){}.content span.enum,.content a.enum,.block a.current.enum{}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{}.content span.keyword,.content a.keyword,.block a.current.keyword{}pre.rust .comment{}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{}pre.rust .kw{}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{}pre.rust .doccomment{}.stab.deprecated{}.content a.attr,.content a.derive,.content a.macro{}.stab.portability{}.content span.primitive,.content a.primitive,.block a.current.primitive{}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{}pre.rust .kw-2,pre.rust .prelude-ty{}.content span.trait,.content a.trait,.block a.current.trait{}.search-results a:focus span{}a.result-trait:focus{}a.result-traitalias:focus{}a.result-mod:focus,a.result-externcrate:focus{}a.result-mod:focus{}a.result-externcrate:focus{}a.result-enum:focus{}a.result-struct:focus{}a.result-union:focus{}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{}a.result-type:focus{}a.result-associatedtype:focus{}a.result-foreigntype:focus{}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{}a.result-constant:focus,a.result-static:focus{}a.result-primitive:focus{}a.result-keyword:focus{}.sidebar a.current.enum{}.sidebar a.current.struct{}.sidebar a.current.foreigntype{}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{}.sidebar a.current.union{}.sidebar a.current.constant .sidebar a.current.static{}.sidebar a.current.primitive{}.sidebar a.current.externcrate .sidebar a.current.mod{}.sidebar a.current.trait{}.sidebar a.current.traitalias{}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{}.sidebar a.current.keyword{}@media (max-width:700px){.sidebar-menu{background-color:#14191f;border-bottom-color:#5c6773;border-right-color:#5c6773;}.sidebar-elems{background-color:#14191f;border-right-color:#5c6773;}#sidebar-filler{background-color:#14191f;border-bottom-color:#5c6773;}}kbd{color:#c5c5c5;background-color:#314559;border-color:#5c6773;border-bottom-color:#5c6773;box-shadow:inset 0 -1px 0 #5c6773;}#theme-picker,#settings-menu,#help-button{border-color:#5c6773;background-color:#0f1419;color:#fff;}#theme-picker>img,#settings-menu>img{filter:invert(100);}#copy-path{color:#fff;}#copy-path>img{filter:invert(70%);}#copy-path:hover>img{filter:invert(100%);}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#e0e0e0;}#theme-choices{border-color:#5c6773;background-color:#0f1419;}#theme-choices>button:not(:first-child){border-top-color:#5c6773;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:rgba(110,110,110,0.33);}@media (max-width:700px){#theme-picker{background:#0f1419;}}.search-results .result-name span.alias{color:#c5c5c5;}.search-results .result-name span.grey{color:#999;}#sidebar-toggle{background-color:#14191f;}#sidebar-toggle:hover{background-color:rgba(70,70,70,0.33);}#source-sidebar{background-color:#14191f;}#source-sidebar>.title{color:#fff;border-bottom-color:#5c6773;}div.files>a:hover,div.name:hover{background-color:#14191f;color:#ffb44c;}div.files>.selected{background-color:#14191f;color:#ffb44c;}.setting-line>.title{border-bottom-color:#5c6773;}input:checked+.slider{background-color:#ffb454 !important;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(15,20,25,1),rgba(15,20,25,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(15,20,25,1),rgba(15,20,25,0));}.toggle-line-inner{background:#616161;}.toggle-line:hover .toggle-line-inner{background:#898989;} \ No newline at end of file diff --git a/docs/doc/brush.svg b/docs/doc/brush.svg deleted file mode 100644 index ea266e8..0000000 --- a/docs/doc/brush.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/doc/dark.css b/docs/doc/dark.css deleted file mode 100644 index a31f453..0000000 --- a/docs/doc/dark.css +++ /dev/null @@ -1 +0,0 @@ -body{background-color:#353535;color:#ddd;}h1,h2,h3,h4{color:#ddd;}h1.fqn{border-bottom-color:#d2d2d2;}h2,h3,h4{border-bottom-color:#d2d2d2;}.in-band{background-color:#353535;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#2A2A2A;}pre,.rustdoc.source .example-wrap{background-color:#2A2A2A;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:#505050;}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff)}*{scrollbar-color:rgb(64,65,67) #717171;}.sidebar{scrollbar-color:rgba(32,34,37,.6) #5a5a5a;}::-webkit-scrollbar-track{background-color:#717171;}::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar::-webkit-scrollbar-track{background-color:#717171;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar .current,.sidebar a:hover{background:#444;}.source .sidebar{background-color:#565656;}.line-numbers span{color:#3B91E2;}.line-numbers .line-highlighted{background-color:#0a042f !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:#DDD;}.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#ddd;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#eee !important;background-color:#616161;}.search-results a:focus span{color:#eee !important;}a.result-trait:focus{background-color:#013191;}a.result-traitalias:focus{background-color:#013191;}a.result-mod:focus,a.result-externcrate:focus{background-color:#884719;}a.result-enum:focus{background-color:#194e9f;}a.result-struct:focus{background-color:#194e9f;}a.result-union:focus{background-color:#194e9f;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#4950ed;}a.result-type:focus{background-color:#194e9f;}a.result-associatedtype:focus{background-color:#884719;}a.result-foreigntype:focus{background-color:#194e9f;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#217d1c;}a.result-constant:focus,a.result-static:focus{background-color:#884719;}a.result-primitive:focus{background-color:#194e9f;}a.result-keyword:focus{background-color:#884719;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#2dbfb8;}.content span.struct,.content a.struct,.block a.current.struct{color:#2dbfb8;}.content span.type,.content a.type,.block a.current.type{color:#2dbfb8;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#D2991D;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#2dbfb8;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#09bd00;}.content span.union,.content a.union,.block a.current.union{color:#2dbfb8;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#D2991D;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#2dbfb8;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#D2991D;}.content span.trait,.content a.trait,.block a.current.trait{color:#b78cf2;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#b78cf2;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#2BAB63;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#D2991D;}.sidebar a{color:#fdbf35;}.sidebar a.current.enum{color:#12ece2;}.sidebar a.current.struct{color:#12ece2;}.sidebar a.current.type{color:#12ece2;}.sidebar a.current.associatedtype{color:#fdbf35;}.sidebar a.current.foreigntype{color:#12ece2;}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{color:#0be900;}.sidebar a.current.union{color:#12ece2;}.sidebar a.current.constant .sidebar a.current.static{color:#fdbf35;}.sidebar a.current.primitive{color:#12ece2;}.sidebar a.current.externcrate .sidebar a.current.mod{color:#fdbf35;}.sidebar a.current.trait{color:#cca7ff;}.sidebar a.current.traitalias{color:#cca7ff;}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{color:#32d479;}.sidebar a.current.keyword{color:#fdbf35;}pre.rust .comment{color:#8d8d8b;}pre.rust .doccomment{color:#8ca375;}nav.main .current{border-top-color:#eee;border-bottom-color:#eee;}nav.main .separator{border-color:#eee;}a{color:#D2991D;}a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a{color:#ddd;}.search-results a{color:#ddd;}a.test-arrow{color:#dedede;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search,.search-input{color:#111;background-color:#f0f0f0;border-color:#000;}.search-input{border-color:#e0e0e0;}.search-input:focus{border-color:#008dfd;}.module-item .stab,.import-item .stab{color:#ddd;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;color:#2f2f2f;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;color:#2f2f2f;}.stab.portability>code{background:none;}#help>div{background:#4d4d4d;border-color:#bfbfbf;}#help span.bottom,#help span.top{border-color:#bfbfbf;}#help dt{border-color:#bfbfbf;background:rgba(0,0,0,0);}.rightside,.out-of-band{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#ddd;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#ab8ac1;}pre.rust .kw-2,pre.rust .prelude-ty{color:#769acb;}pre.rust .number,pre.rust .string{color:#83a300;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#ee6868;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#d97f26;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#4a4949;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target{background-color:#494a3d;border-right:3px solid #bb7410;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.8);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.8);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.8);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.8);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;border-color:#000;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#111;border-color:#777;}.notable-traits-tooltiptext .notable{border-bottom-color:#d2d2d2;}#titles>button:not(.selected){background-color:#252525;border-top-color:#252525;}#titles>button:hover,#titles>button.selected{border-top-color:#0089ff;background-color:#353535;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#505050;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#505050;border-right-color:#000;}#sidebar-filler{background-color:#505050;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow:inset 0 -1px 0 #c6cbd1;}#theme-picker,#settings-menu,#help-button{border-color:#e0e0e0;background:#f0f0f0;color:#000;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#ffb900;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(65%);}#theme-choices{border-color:#e0e0e0;background-color:#353535;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#4e4e4e;}@media (max-width:700px){#theme-picker{background:#f0f0f0;}}.search-results .result-name span.alias{color:#fff;}.search-results .result-name span.grey{color:#ccc;}#sidebar-toggle{background-color:#565656;}#sidebar-toggle:hover{background-color:#676767;}#source-sidebar{background-color:#565656;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#444;}div.files>.selected{background-color:#333;}.setting-line>.title{border-bottom-color:#ddd;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(53,53,53,1),rgba(53,53,53,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(53,53,53,1),rgba(53,53,53,0));}.toggle-line-inner{background:#616161;}.toggle-line:hover .toggle-line-inner{background:#898989;} \ No newline at end of file diff --git a/docs/doc/down-arrow.svg b/docs/doc/down-arrow.svg deleted file mode 100644 index 35437e7..0000000 --- a/docs/doc/down-arrow.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/doc/help.html b/docs/doc/help.html new file mode 100644 index 0000000..4753476 --- /dev/null +++ b/docs/doc/help.html @@ -0,0 +1 @@ +
fn:) to \
- restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \
- enum, trait, type, macro, \
- and const.","Search functions by type signature (e.g., vec -> usize or \
- * -> vec)","Search multiple things at once by splitting your query with comma (e.g., \
- str,u8 or String,struct:Vec,test)","You can look for items with an exact name by putting double quotes around \
- your request: \"string\"","Look for items inside another one by searching for a path: vec::Vec",].map(function(x){return""+x+"
"}).join("");var div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="ExampleField.","Number of bytes used by an instance of ExampleField.","Optional docstring for my example bit field.","Maximum valid integer for ExampleField.","Returns the current field value as a binary formatted …","Returns the current field value as a u8","","","","","","","","","Sets the value of the bit at the supplied index to 0.","","","Returns a new ExampleFieldwith ones for flags that were …","","Returns a new ExampleFieldwith ones for flags that do not …","","","","Returns the argument unchanged.","","Create a new instance of ExampleField from a binary string.","Create a new instance of ExampleField from a binary string.","Returns the value of the bit at the supplied index as a …","Returns a new ExampleFieldwith ones for flags that were …","Calls U::from(self).","Returns a new ExampleFieldwith ones for flags that were …","Returns a new ExampleFieldwith ones for flags that do not …","Returns a new ExampleFieldwith ones for flags that were …","","Create a new instance of ExampleField from a u8 value.","Create a new instance of ExampleField from the maximum …","","Sets the value of the bit at the supplied index to 1.","","Flips the value of the bit at the supplied index.","","","","Create a new instance of ExampleField from 0.","Number of bits in an instance of ExampleField.","Number of bytes used by an instance of ExampleField.","Optional docstring for my example bit field.","Optional docstring for my flag enum.","Optional docstring for Flag0","Optional docstring for Flag1","Optional docstring for Flag2","Optional docstring for Flag3","Optional docstring for Flag4","Optional docstring for Flag5","Optional docstring for Flag6","Optional docstring for Flag7","Maximum valid integer for ExampleField.","Returns the current field value as a binary formatted …","Returns the current field value as a u8","","","","","","","","","","","","","","","","","","","","Sets the value of the bit at the supplied flag to 0.","Sets the value of the bit at the supplied index to 0.","","","","","Returns a new ExampleFieldwith ones for flags that were …","","Returns a new ExampleFieldwith ones for flags that do not …","","","","","","","Returns the argument unchanged.","","","Returns the argument unchanged.","Create a new instance of ExampleField from a binary string.","Create a new instance of ExampleField from a binary string.","Returns the value of the bit at the supplied flag as a …","Returns the value of the bit at the supplied index as a …","Returns a new ExampleFieldwith ones for flags that were …","Calls U::from(self).","Calls U::from(self).","Returns a new ExampleFieldwith ones for flags that were …","Returns a new ExampleFieldwith ones for flags that do not …","Returns a new ExampleFieldwith ones for flags that were …","","Create a new instance of ExampleField from a u8 value.","Create a new instance of ExampleField from the maximum …","","","Sets the value of the bit at the supplied flag to 1.","Sets the value of the bit at the supplied index to 1.","","","Flips the value of the bit at the supplied flag.","Flips the value of the bit at the supplied index.","","","","","","","Create a new instance of ExampleField from 0."],"i":[0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,0,0,3,3,3,3,3,3,3,3,2,2,2,3,2,2,2,2,3,2,2,2,2,3,2,2,2,2,3,2,3,2,2,2,3,2,3,2,2,2,2,3,2,3,2,2,3,3,2,2,2,2,2,2,2,2,3,2,2,2,2,2,2,2,3,2,2,2,3,2,2,2,3,2,3,2,3,2,2],"f":[null,null,null,null,null,null,null,null,[[["",0]],["string",3]],[[["",0]],["u8",0]],[[]],[[["",0]]],[[]],[[["",0]]],[[]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0],["u8",0]]],[[["",0]],["examplefield",3]],[[["",0],["",0]]],[[["",0]]],[[]],[[["",0]]],[[["",0],["examplefield",3]],["bool",0]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[]],[[["u8",0]],["examplefield",3]],[[["str",0]]],[[["string",3]]],[[["",0],["u8",0]],["bool",0]],[[["",0]]],[[]],[[]],[[]],[[]],[[["",0],["examplefield",3]],["bool",0]],[[["u8",0]]],[[]],[[["",0],["examplefield",3]],["option",4,[["ordering",4]]]],[[["",0],["u8",0]]],[[["",0]]],[[["",0],["u8",0]]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[]],null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]],["string",3]],[[["",0]],["u8",0]],[[]],[[["exampleflags",4]]],[[]],[[["",0],["exampleflags",4]]],[[["",0]]],[[]],[[]],[[["exampleflags",4]]],[[["",0],["exampleflags",4]]],[[["",0]]],[[]],[[["exampleflags",4]]],[[]],[[["",0],["exampleflags",4]]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0],["exampleflags",4]],["",0]],[[["",0],["u8",0]]],[[["",0]],["exampleflags",4]],[[["",0]],["examplefield",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0]]],[[]],[[["",0]]],[[["",0],["exampleflags",4]],["bool",0]],[[["",0],["examplefield",3]],["bool",0]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["u8",0]],["exampleflags",4]],[[]],[[["u8",0]],["examplefield",3]],[[["exampleflags",4]],["examplefield",3]],[[]],[[["str",0]]],[[["string",3]]],[[["",0],["exampleflags",4]],["bool",0]],[[["",0],["u8",0]],["bool",0]],[[["",0]]],[[]],[[]],[[]],[[]],[[]],[[["",0],["examplefield",3]],["bool",0]],[[["u8",0]]],[[]],[[["",0],["exampleflags",4]],["option",4,[["ordering",4]]]],[[["",0],["examplefield",3]],["option",4,[["ordering",4]]]],[[["",0],["exampleflags",4]],["",0]],[[["",0],["u8",0]]],[[["",0]]],[[["",0]]],[[["",0],["exampleflags",4]],["",0]],[[["",0],["u8",0]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[]]],"p":[[3,"ExampleField"],[3,"ExampleField"],[4,"ExampleFlags"]]}\
+"ubits":{"doc":"crates.io Downloads Build Docs Licence","t":"OAAASSDSLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLSSDENNNNNNNNSLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL","n":["bitfield","examples","flagless_example","full_example","BITS","BYTES","ExampleField","MAX","as_binary","as_integer","bitand","bitand_assign","bitor","bitor_assign","bitxor","bitxor_assign","borrow","borrow_mut","clear_index","clone","clone_into","combine","default","diff","eq","fmt","fmt","from","from","from_binary_str","from_binary_string","get_index","intersect","into","into_combined","into_diff","into_intersection","new","ones","partial_cmp","set_index","to_owned","toggle_index","try_from","try_into","type_id","zeros","BITS","BYTES","ExampleField","ExampleFlags","Flag0","Flag1","Flag2","Flag3","Flag4","Flag5","Flag6","Flag7","MAX","as_binary","as_integer","bitand","bitand","bitand","bitand","bitand","bitand_assign","bitand_assign","bitor","bitor","bitor","bitor","bitor","bitor_assign","bitor_assign","bitxor","bitxor","bitxor","bitxor","bitxor","bitxor_assign","bitxor_assign","borrow","borrow","borrow_mut","borrow_mut","clear","clear_index","clone","clone","clone_into","clone_into","combine","default","diff","eq","eq","fmt","fmt","fmt","from","from","from","from","from","from_binary_str","from_binary_string","get","get_index","intersect","into","into","into_combined","into_diff","into_intersection","new","ones","partial_cmp","partial_cmp","set","set_index","to_owned","to_owned","toggle","toggle_index","try_from","try_from","try_into","try_into","type_id","type_id","zeros"],"q":[[0,"ubits"],[2,"ubits::examples"],[4,"ubits::examples::flagless_example"],[47,"ubits::examples::full_example"]],"d":["Generates a bitfield struct and a corresponding flag enum.","Examples of generated output using different …","Example of generated output, using only a bit field …","Example of generated output, using both a bit field and a …","Number of bits in an instance of ExampleField.","Number of bytes used by an instance of ExampleField.","Optional docstring for my example bit field.","Maximum valid integer for ExampleField.","Returns the current field value as a binary formatted …","Returns the current field value as a u8","","","","","","","","","Sets the value of the bit at the supplied index to 0.","","","Returns a new ExampleFieldwith ones for flags that were …","","Returns a new ExampleFieldwith ones for flags that do not …","","","","","Returns the argument unchanged.","Create a new instance of ExampleField from a binary string.","Create a new instance of ExampleField from a binary string.","Returns the value of the bit at the supplied index as a …","Returns a new ExampleFieldwith ones for flags that were …","Calls U::from(self).","Returns a new ExampleFieldwith ones for flags that were …","Returns a new ExampleFieldwith ones for flags that do not …","Returns a new ExampleFieldwith ones for flags that were …","Create a new instance of ExampleField from a u8 value.","Create a new instance of ExampleField from the maximum …","","Sets the value of the bit at the supplied index to 1.","","Flips the value of the bit at the supplied index.","","","","Create a new instance of ExampleField from 0.","Number of bits in an instance of ExampleField.","Number of bytes used by an instance of ExampleField.","Optional docstring for my example bit field.","Optional docstring for my flag enum.","Optional docstring for Flag0","Optional docstring for Flag1","Optional docstring for Flag2","Optional docstring for Flag3","Optional docstring for Flag4","Optional docstring for Flag5","Optional docstring for Flag6","Optional docstring for Flag7","Maximum valid integer for ExampleField.","Returns the current field value as a binary formatted …","Returns the current field value as a u8","","","","","","","","","","","","","","","","","","","","","","","","","","Sets the value of the bit at the supplied flag to 0.","Sets the value of the bit at the supplied index to 0.","","","","","Returns a new ExampleFieldwith ones for flags that were …","","Returns a new ExampleFieldwith ones for flags that do not …","","","","","","Returns the argument unchanged.","","Returns the argument unchanged.","","","Create a new instance of ExampleField from a binary string.","Create a new instance of ExampleField from a binary string.","Returns the value of the bit at the supplied flag as a …","Returns the value of the bit at the supplied index as a …","Returns a new ExampleFieldwith ones for flags that were …","Calls U::from(self).","Calls U::from(self).","Returns a new ExampleFieldwith ones for flags that were …","Returns a new ExampleFieldwith ones for flags that do not …","Returns a new ExampleFieldwith ones for flags that were …","Create a new instance of ExampleField from a u8 value.","Create a new instance of ExampleField from the maximum …","","","Sets the value of the bit at the supplied flag to 1.","Sets the value of the bit at the supplied index to 1.","","","Flips the value of the bit at the supplied flag.","Flips the value of the bit at the supplied index.","","","","","","","Create a new instance of ExampleField from 0."],"i":[0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,12,0,0,13,13,13,13,13,13,13,13,12,12,12,13,12,12,12,12,12,12,13,12,12,12,12,12,12,13,12,12,12,12,12,12,13,12,13,12,12,12,13,12,13,12,12,12,12,13,12,13,12,12,13,13,12,12,12,12,12,12,12,12,13,12,12,12,12,12,12,13,12,12,12,13,12,12,12,13,12,13,12,13,12,12],"f":[0,0,0,0,0,0,0,0,[1,2],[1,3],[[1,1]],[[1,1]],[[1,1]],[[1,1]],[[1,1]],[[1,1]],[[]],[[]],[[1,3]],[1,1],[[]],[[1,1],1],[[],1],[[1,1],1],[[1,1],4],[[1,5],6],[[1,5],6],[3,1],[[]],[7,1],[2,1],[[1,3],4],[[1,1],1],[[]],[[1,1],1],[[1,1],1],[[1,1],1],[3,1],[[],1],[[1,1],[[9,[8]]]],[[1,3]],[[]],[[1,3]],[[],10],[[],10],[[],11],[[],1],0,0,0,0,0,0,0,0,0,0,0,0,0,[12,2],[12,3],[[13,13]],[[12,13]],[[12,13]],[[12,12]],[[12,13]],[[12,13]],[[12,12]],[[13,13]],[[12,13]],[[12,13]],[[12,13]],[[12,12]],[[12,12]],[[12,13]],[[13,13]],[[12,13]],[[12,12]],[[12,13]],[[12,13]],[[12,12]],[[12,13]],[[]],[[]],[[]],[[]],[[12,13],12],[[12,3]],[13,13],[12,12],[[]],[[]],[[12,12],12],[[],12],[[12,12],12],[[13,13],4],[[12,12],4],[[13,5],6],[[12,5],6],[[12,5],6],[[]],[3,13],[[]],[13,12],[3,12],[7,12],[2,12],[[12,13],4],[[12,3],4],[[12,12],12],[[]],[[]],[[12,12],12],[[12,12],12],[[12,12],12],[3,12],[[],12],[[13,13],[[9,[8]]]],[[12,12],[[9,[8]]]],[[12,13],12],[[12,3]],[[]],[[]],[[12,13],12],[[12,3]],[[],10],[[],10],[[],10],[[],10],[[],11],[[],11],[[],12]],"c":[],"p":[[3,"ExampleField"],[3,"String"],[15,"u8"],[15,"bool"],[3,"Formatter"],[6,"Result"],[15,"str"],[4,"Ordering"],[4,"Option"],[4,"Result"],[3,"TypeId"],[3,"ExampleField"],[4,"ExampleFlags"]]}\
}');
-if (window.initSearch) {window.initSearch(searchIndex)};
\ No newline at end of file
+if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)};
+if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
diff --git a/docs/doc/search.js b/docs/doc/search.js
deleted file mode 100644
index a8026db..0000000
--- a/docs/doc/search.js
+++ /dev/null
@@ -1,2 +0,0 @@
-(function(){var itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias",];var TY_PRIMITIVE=itemTypes.indexOf("primitive");var TY_KEYWORD=itemTypes.indexOf("keyword");function printTab(nb){if(nb===0||nb===1||nb===2){searchState.currentTab=nb}var nb_copy=nb;onEachLazy(document.getElementById("titles").childNodes,function(elem){if(nb_copy===0){addClass(elem,"selected")}else{removeClass(elem,"selected")}nb_copy-=1});onEachLazy(document.getElementById("results").childNodes,function(elem){if(nb===0){addClass(elem,"active")}else{removeClass(elem,"active")}nb-=1})}function removeEmptyStringsFromArray(x){for(var i=0,len=x.length;i1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50 - 51 - 52 - 53 - 54 - 55 - 56 - 57 - 58 - 59 - 60 - 61 - 62 - 63 - 64 - 65 - 66 - 67 - 68 - 69 - 70 - 71 - 72 - 73 - 74 - 75 - 76 - 77 - 78 - 79 - 80 - 81 - 82 - 83 - 84 - 85 - 86 - 87 - 88 - 89 - 90 - 91 - 92 - 93 - 94 - 95 - 96 - 97 - 98 - 99 - 100 - 101 - 102 - 103 - 104 - 105 - 106 - 107 - 108 - 109 - 110 - 111 - 112 - 113 - 114 - 115 - 116 - 117 - 118 - 119 - 120 - 121 - 122 - 123 - 124 - 125 - 126 - 127 - 128 - 129 - 130 - 131 - 132 - 133 - 134 - 135 - 136 - 137 - 138 - 139 - 140 - 141 - 142 - 143 - 144 - 145 - 146 - 147 - 148 - 149 - 150 - 151 - 152 - 153 - 154 - 155 - 156 - 157 - 158 - 159 - 160 - 161 - 162 - 163 - 164 - 165 - 166 - 167 - 168 - 169 - 170 - 171 - 172 - 173 - 174 - 175 - 176 - 177 - 178 - 179 - 180 - 181 - 182 - 183 - 184 - 185 - 186 - 187 - 188 - 189 - 190 - 191 - 192 - 193 - 194 - 195 - 196 - 197 - 198 - 199 - 200 - 201 - 202 - 203 - 204 - 205 - 206 - 207 - 208 - 209 - 210 - 211 - 212 - 213 - 214 - 215 - 216 - 217 - 218 - 219 - 220 - 221 - 222 - 223 - 224 - 225 - 226 - 227 - 228 - 229 - 230 - 231 - 232 - 233 - 234 - 235 - 236 - 237 - 238 - 239 - 240 - 241 - 242 - 243 - 244 - 245 - 246 - 247 - 248 - 249 - 250 - 251 - 252 - 253 - 254 - 255 - 256 - 257 - 258 - 259 - 260 - 261 - 262 - 263 - 264 - 265 - 266 - 267 - 268 - 269 - 270 - 271 - 272 - 273 - 274 - 275 - 276 - 277 - 278 - 279 - 280 - 281 - 282 - 283 - 284 - 285 - 286 - 287 - 288 - 289 - 290 - 291 - 292 - 293 - 294 - 295 - 296 - 297 - 298 - 299 - 300 - 301 - 302 - 303 - 304 - 305 - 306 - 307 - 308 - 309 - 310 - 311 - 312 - 313 - 314 - 315 - 316 - 317 - 318 - 319 - 320 - 321 - 322 - 323 - 324 - 325 - 326 - 327 - 328 - 329 - 330 - 331 - 332 - 333 - 334 - 335 - 336 - 337 - 338 - 339 - 340 - 341 - 342 - 343 - 344 - 345 - 346 - 347 - 348 - 349 - 350 - 351 - 352 - 353 - 354 - 355 - 356 - 357 - 358 - 359 - 360 - 361 - 362 - 363 - 364 - 365 - 366 - 367 - 368 - 369 - 370 - 371 - 372 - 373 - 374 - 375 - 376 - 377 - 378 - 379 - 380 - 381 - 382 - 383 - 384 - 385 - 386 - 387 - 388 - 389 - 390 - 391 - 392 - 393 - 394 - 395 - 396 - 397 - 398 - 399 - 400 - 401 - 402 - 403 - 404 - 405 - 406 - 407 - 408 - 409 - 410 - 411 - 412 - 413 - 414 - 415 - 416 - 417 - 418 - 419 - 420 - 421 - 422 - 423 - 424 - 425 - 426 - 427 - 428 - 429 - 430 - 431 - 432 - 433 - 434 - 435 - 436 - 437 - 438 - 439 - 440 - 441 - 442 - 443 - 444 - 445 - 446 - 447 - 448 - 449 - 450 - 451 - 452 - 453 - 454 - 455 - 456 - 457 - 458 - 459 - 460 - 461 - 462 - 463 - 464 - 465 - 466 - 467 - 468 - 469 - 470 - 471 - 472 - 473 - 474 - 475 - 476 - 477 - 478 - 479 - 480 - 481 - 482 - 483 - 484 - 485 - 486 - 487 - 488 - 489 - 490 - 491 - 492 - 493 - 494 - 495 - 496 - 497 - 498 - 499 - 500 - 501 - 502 - 503 - 504 - 505 - 506 - 507 - 508 - 509 - 510 - 511 - 512 - 513 - 514 - 515 - 516 - 517 - 518 - 519 - 520 - 521 - 522 - 523 - 524 - 525 - 526 - 527 - 528 - 529 - 530 - 531 - 532 - 533 - 534 - 535 - 536 - 537 - 538 - 539 - 540 - 541 - 542 - 543 - 544 - 545 - 546 - 547 - 548 - 549 - 550 - 551 - 552 - 553 - 554 - 555 - 556 - 557 - 558 - 559 - 560 - 561 - 562 - 563 - 564 - 565 - 566 - 567 - 568 - 569 - 570 - 571 - 572 - 573 - 574 - 575 - 576 - 577 - 578 - 579 - 580 - 581 - 582 - 583 - 584 - 585 - 586 - 587 - 588 - 589 - 590 - 591 - 592 - 593 - 594 - 595 - 596 - 597 - 598 - 599 - 600 - 601 - 602 - 603 - 604 - 605 - 606 - 607 - 608 - 609 - 610 - 611 - 612 - 613 - 614 - 615 - 616 - 617 - 618 - 619 - 620 - 621 - 622 - 623 - 624 - 625 - 626 - 627 - 628 - 629 - 630 - 631 - 632 - 633 - 634 - 635 - 636 - 637 - 638 - 639 - 640 - 641 - 642 - 643 - 644 - 645 - 646 - 647 - 648 - 649 - 650 - 651 - 652 - 653 - 654 - 655 - 656 - 657 - 658 - 659 - 660 - 661 - 662 - 663 - 664 - 665 - 666 - 667 - 668 - 669 - 670 - 671 - 672 - 673 - 674 - 675 - 676 - 677 - 678 - 679 - 680 - 681 - 682 - 683 - 684 - 685 - 686 - 687 - 688 - 689 - 690 - 691 - 692 - 693 - 694 - 695 - 696 - 697 - 698 - 699 - 700 - 701 - 702 - 703 - 704 - 705 - 706 - 707 - 708 - 709 - 710 - 711 - 712 - 713 - 714 - 715 - 716 - 717 - 718 - 719 - 720 - 721 - 722 - 723 - 724 - 725 - 726 - 727 - 728 - 729 - 730 - 731 - 732 - 733 - 734 - 735 - 736 - 737 - 738 - 739 - 740 - 741 - 742 - 743 - 744 - 745 - 746 - 747 - 748 - 749 - 750 - 751 - 752 - 753 - 754 - 755 - 756 - 757 - 758 - 759 - 760 - 761 - 762 - 763 - 764 - 765 - 766 - 767 - 768 - 769 - 770 - 771 - 772 - 773 - 774 - 775 - 776 - 777 - 778 - 779 - 780 - 781 - 782 - 783 - 784 - 785 - 786 - 787 - 788 - 789 - 790 - 791 - 792 - 793 - 794 - 795 - 796 - 797 - 798 - 799 - 800 - 801 - 802 - 803 - 804 - 805 - 806 - 807 - 808 - 809 - 810 - 811 - 812 - 813 - 814 - 815 - 816 - 817 - 818 - 819 - 820 - 821 - 822 - 823 - 824 - 825 - 826 - 827 - 828 - 829 - 830 - 831 - 832 - 833 - 834 - 835 - 836 - 837 - 838 - 839 - 840 - 841 - 842 - 843 - 844 - 845 - 846 - 847 - 848 - 849 - 850 - 851 - 852 - 853 - 854 - 855 - 856 - 857 - 858 - 859 - 860 - 861 - 862 - 863 - 864 - 865 - 866 - 867 - 868 - 869 - 870 - 871 - 872 - 873 - 874 - 875 - 876 - 877 - 878 - 879 - 880 - 881 - 882 - 883 - 884 - 885 - 886 - 887 - 888 - 889 - 890 - 891 - 892 - 893 - 894 - 895 - 896 - 897 - 898 - 899 - 900 - 901 - 902 - 903 - 904 - 905 - 906 - 907 - 908 - 909 - 910 - 911 - 912 - 913 - 914 - 915 - 916 - 917 - 918 - 919 - 920 - 921 - 922 - 923 - 924 - 925 - 926 - 927 - 928 - 929 - 930 - 931 - 932 - 933 - 934 - 935 - 936 - 937 - 938 - 939 - 940 - 941 - 942 - 943 - 944 - 945 - 946 - 947 - 948 - 949 - 950 - 951 - 952 - 953 - 954 - 955 - 956 - 957 - 958 - 959 - 960 - 961 - 962 - 963 - 964 - 965 - 966 - 967 - 968 - 969 - 970 - 971 - 972 - 973 - 974 - 975 - 976 - 977 - 978 - 979 - 980 - 981 - 982 - 983 - 984 - 985 - 986 - 987 - 988 - 989 - 990 - 991 - 992 - 993 - 994 - 995 - 996 - 997 - 998 - 999 -1000 -1001 -1002 -1003 -1004 -1005 -1006 -1007 -1008 -1009 -1010 -1011 -1012 -1013 -1014 -1015 -1016 -1017 -1018 -1019 -1020 -1021 -1022 -1023 -1024 -1025 -1026 -1027 -1028 -1029 -1030 -1031 -1032 -1033 -1034 -1035 -1036 -1037 -1038 -1039 -1040 -1041 -1042 -1043 -1044 -1045 -1046 -1047 -1048 -1049 -1050 -1051 -1052 -1053 -1054 -1055 -1056 -1057 -1058 -1059 -1060 -1061 -1062 -1063 -1064 -1065 -1066 -1067 -1068 -1069 -1070 -1071 -1072 -1073 -1074 -1075 -1076 -1077 -1078 -1079 -1080 -1081 -1082 -1083 -1084 -1085 -1086 -1087 -1088 -1089 -1090 -1091 -1092 -1093 -1094 -1095 -1096 -1097 -1098 -1099 -1100 -1101 -1102 -1103 -1104 -1105 -1106 -1107 -1108 -1109 -1110 -1111 -1112 -1113 -1114 -1115 -1116 -1117 -1118 -1119 -1120 -1121 -1122 -1123 -1124 -1125 -1126 -1127 -1128 -1129 -1130 -1131 -1132 -1133 -1134 -1135 -1136 -1137 -1138 -1139 -1140 -1141 -1142 -1143 -1144 -1145 -1146 -1147 -1148 -1149 -1150 -1151 -1152 -1153 -1154 -1155 -1156 -1157 -1158 -1159 -1160 -1161 -1162 -1163 -1164 -1165 -1166 -1167 -1168 -1169 -1170 -1171 -1172 -1173 -1174 -1175 -1176 -1177 -1178 -1179 -1180 -1181 -1182 -1183 -1184 -1185 -1186 -1187 -1188 -1189 -1190 -1191 -1192 -1193 -1194 -1195 -1196 -1197 -1198 -1199 -1200 -1201 -1202 -1203 -1204 -1205 -1206 -1207 -1208 -1209 -1210 -1211 -1212 -1213 -1214 -1215 -1216 -1217 -1218 -1219 -1220 -1221 -1222 -1223 -1224 -1225 -1226 -1227 -1228 -1229 -1230 -1231 -1232 -1233 -1234 -1235 -1236 -1237 -1238 -1239 -1240 -1241 -1242 -1243 -1244 -1245 -1246 -1247 -1248 -1249 -1250 -1251 -1252 -1253 -1254 -1255 -1256 -1257 -1258 -1259 -1260 -1261 -1262 -1263 -1264 -1265 -1266 -1267 -1268 -1269 -1270 -1271 -1272 -1273 -1274 -1275 -1276 -1277 -1278 -1279 -1280 -1281 -1282 -1283 -1284 -1285 -1286 -1287 -1288 -1289 -1290 -1291 -1292 -1293 -1294 -1295 -1296 -1297 -1298 -1299 -1300 -1301 -1302 -1303 -1304 -1305 -1306 -1307 -1308 -1309 -1310 -1311 -1312 -1313 -1314 -1315 -1316 -1317 -1318 -1319 -1320 -1321 -1322 -1323 -1324 -1325 -1326 -1327 -1328 -1329 -1330 -1331 -1332 -1333 -1334 -1335 -1336 -1337 -1338 -1339 -1340 -1341 -1342 -1343 -1344 -1345 -1346 -1347 -1348 -1349 -1350 -1351 -1352 -1353 -1354 -1355 -1356 -1357 -1358 -1359 -1360 -1361 -1362 -1363 -1364 -1365 -1366 -1367 -1368 -1369 -1370 -1371 -1372 -1373 -1374 -1375 -1376 -1377 -1378 -1379 -1380 -1381 -1382 -1383 -1384 -1385 -1386 -1387 -1388 -1389 -1390 -1391 -1392 -1393 -1394 -1395 -1396 -1397 -1398 -1399 -1400 -1401 -1402 -1403 -1404 -1405 -1406 -1407 -1408 -1409 -1410 -1411 -1412 -1413 -1414 -1415 -1416 -1417 -1418 -1419 -1420 -1421 -1422 -1423 -1424 -1425 -1426 -1427 -1428 -1429 -1430 -1431 -1432 -1433 -1434 -1435 -1436 -1437 -1438 -1439 -1440 -1441 -1442 -1443 -1444 -1445 -1446 -1447 -1448 -1449 -1450 -1451 -1452 -1453 -1454 -1455 -1456 -1457 -1458 -1459 -1460 -1461 -1462 -1463 -1464 -1465 -1466 -1467 -1468 -1469 -1470 -1471 -1472 -1473 -1474 -1475 -1476 -1477 -1478 -1479 -1480 -1481 -1482 -1483 -1484 -1485 -1486 -1487 -1488 -1489 -1490 -1491 -1492 -1493 -1494 -1495 -1496 -1497 -1498 -1499 -1500 -1501 -1502 -1503 -1504 -1505 -1506 -1507 -1508 -1509 -1510 -1511 -1512 -1513 -1514 -1515 -1516 -1517 -1518 -1519 -1520 -1521 -1522 -1523 -1524 -1525 -1526 -1527 -1528 -1529 -1530 -1531 -1532 -1533 -1534 -1535 -1536 -1537 -1538 -1539 -1540 -1541 -1542 -1543 -1544 -1545 -1546 -1547 -1548 -1549 -1550 -1551 -1552 -1553 -1554 -1555 -1556 -1557 -1558 -1559 -1560 -1561 -1562 -1563 -1564 -1565 -1566 -1567 -1568 -1569 -1570 -1571 -1572 -1573 -1574 -1575 -1576 -1577 -1578 -1579 -1580 -1581 -1582 -1583 -1584 -1585 -1586 -1587 -1588 -1589 -1590 -1591 -1592 -1593 -1594 -1595 -1596 -1597 -1598 -1599 -1600 -1601 -1602 -1603 -1604 -1605 -1606 -1607 -1608 -1609 -1610 -1611 -1612 -1613 -1614 -1615 -1616 -1617 -1618 -1619 -1620 -1621 -1622 -1623 -1624 -1625 -1626 -1627 -1628 -1629 -1630 -1631 -1632 -1633 -1634 -1635 -1636 -1637 -1638 -1639 -1640 -1641 -1642 -1643 -1644 -1645 -1646 -1647 -1648 -1649 -1650 -1651 -1652 -1653 -1654 -1655 -1656 -1657 -1658 -1659 -1660 -1661 -1662 -1663 -1664 -1665 -1666 -1667 -1668 -1669 -1670 -1671 -1672 -1673 -1674 -1675 -1676 -1677 -1678 -1679 -1680 -1681 -1682 -1683 -1684 -1685 -1686 -1687 -1688 -1689 -1690 -1691 -1692 -1693 -1694 -1695 -1696 -1697 -1698 -1699 -1700 -1701 -1702 -1703 -1704 -1705 -1706 -1707 -1708 -1709 -1710 -1711 -1712 -1713 -1714 -1715 -1716 -1717 -1718 -1719 -1720 -1721 -1722 -1723 -1724 -1725 -1726 -1727 -1728 -1729 -1730 -1731 -1732 -1733 -1734 -1735 -1736 -1737 -1738 -1739 -1740 -1741 -1742 -1743 -1744 -1745 -1746 -1747 -1748 -1749 -1750 -1751 -1752 -1753 -1754 -1755 -1756 -1757 -1758 -1759 -1760 -1761 -1762 -1763 -1764 -1765 -1766 -1767 -1768 -1769 -1770 -1771 -1772 -1773 -1774 -1775 -1776 -1777 -1778 -1779 -1780 -1781 -1782 -1783 -1784 -1785 -1786 -1787 -1788 -1789 -1790 -1791 -1792 -1793 -1794 -1795 -1796 -1797 -1798 -1799 -1800 -1801 -1802 -1803 -1804 -1805 -1806 -1807 -1808 -1809 -1810 -1811 -1812 -1813 -1814 -1815 -1816 -1817 -1818 -1819 -1820 -1821 -1822 -1823 -1824 -1825 -1826 -1827 -1828 -1829 -1830 -1831 -1832 -1833 -1834 -1835 -1836 -1837 -1838 -1839 -1840 -1841 -1842 -1843 -1844 -1845 -1846 -1847 -1848 -1849 -1850 -1851 -1852 -1853 -1854 -1855 -1856 -1857 -1858 -1859 -1860 -1861 -1862 -1863 -1864 -1865 -1866 -1867 -1868 -1869 -1870 -1871 -1872 -1873 -1874 -1875 -1876 -1877 -1878 -1879 -1880 -1881 -1882 -1883 -1884 -1885 -1886 -1887 -1888 -1889 -1890 -1891 -1892 -1893 -1894 -1895 -1896 -1897 -1898 -1899 -1900 -1901 -1902 -1903 -1904 -1905 -1906 -1907 -1908 -1909 -1910 -1911 -1912 -1913 -1914 -1915 -1916 -1917 -1918 -1919 -1920 -1921 -1922 -1923 -1924 -1925 -1926 -1927 -1928 -1929 -1930 -1931 -1932 -1933 -1934 -1935 -1936 -1937 -1938 -1939 -1940 -1941 -1942 -1943 -1944 -1945 -1946 -1947 -1948 -1949 -1950 -1951 -1952 -1953 -1954 -1955 -1956 -1957 -1958 -1959 -1960 -1961 -1962 -1963 -1964 -1965 -1966 -1967 -1968 -1969 -1970 -1971 -1972 -1973 -1974 -1975 -1976 -1977 -1978 -1979 -1980 -1981 -1982 -1983 -1984 -1985 -1986 -1987 -1988 -1989 -1990 -1991 -1992 -1993 -1994 -1995 -1996 -1997 -1998 -1999 -2000 -2001 -2002 -2003 -2004 -2005 -2006 -2007 -2008 -2009 -2010 -2011 -2012 -2013 -2014 -2015 -2016 -2017 -2018 -2019 -2020 -2021 -2022 -2023 -2024 -2025 -2026 -2027 -2028 -2029 -2030 -2031 -2032 -2033 -2034 -2035 -2036 -2037 -2038 -2039 -2040 -2041 -2042 -2043 -2044 -2045 -2046 -2047 -2048 -2049 -2050 -2051 -2052 -2053 -2054 -2055 -2056 -2057 -2058 -2059 -2060 -2061 -2062 -2063 -2064 -2065 -2066 -2067 -2068 -2069 -2070 -2071 -2072 -2073 -2074 -2075 -2076 -2077 -2078 -2079 -2080 -2081 -2082 -2083 -2084 -2085 -2086 -2087 -2088 -2089 -2090 -2091 -2092 -2093 -2094 -2095 -2096 -2097 -2098 -2099 -2100 -2101 -2102 -2103 -2104 -2105 -2106 -2107 -2108 -2109 -2110 -2111 -2112 -2113 -2114 -2115 -2116 -2117 -2118 -2119 -2120 -2121 -2122 -2123 -2124 -2125 -2126 -2127 -2128 -2129 -2130 -2131 -2132 -2133 -2134 -2135 -2136 -2137 -2138 -2139 -2140 -2141 -2142 -2143 -2144 -2145 -2146 -2147 -2148 -2149 -2150 -2151 -2152 -2153 -2154 -2155 -2156 -2157 -2158 -2159 -2160 -2161 -2162 -2163 -2164 -2165 -2166 -2167 -2168 -2169 -2170 -2171 -2172 -2173 -2174 -2175 -2176 -2177 -2178 -2179 -2180 -2181 -2182 -2183 -2184 -2185 -2186 -2187 -2188 -2189 -2190 -2191 -2192 -2193 -2194 -2195 -2196 -2197 -2198 -2199 -2200 -2201 -2202 -2203 -2204 -2205 -2206 -2207 -2208 -2209 -2210 -2211 -2212 -2213 -2214 -2215 -2216 -2217 -2218 -2219 -2220 -2221 -2222 -2223 -2224 -2225 -2226 -2227 -2228 -2229 -2230 -2231 -2232 -2233 -2234 -2235 -2236 -2237 -2238 -2239 -2240 -2241 -2242 -2243 -2244 -2245 -2246 -2247 -2248 -2249 -2250 -2251 -2252 -2253 -2254 -2255 -2256 -2257 -2258 -2259 -2260 -2261 -2262 -2263 -2264 -2265 -2266 -2267 -2268 -2269 -2270 -2271 -2272 -2273 -2274 -2275 -2276 -2277 -2278 -2279 -2280 -2281 -2282 -2283 -2284 -2285 -2286 -2287 -2288 -2289 -2290 -2291 -2292 -2293 -2294 -2295 -2296 -2297 -2298 -2299 -2300 -2301 -2302 -2303 -2304 -2305 -2306 -2307 -2308 -2309 -2310 -2311 -2312 -2313 -2314 -2315 -2316 -2317 -2318 -2319 -2320 -2321 -2322 -2323 -2324 -2325 -2326 -2327 -2328 -2329 -2330 -2331 -2332 -2333 -2334 -2335 -2336 -2337 -2338 -2339 -2340 -2341 -2342 -2343 -2344 -2345 -2346 -2347 -2348 -2349 -2350 -2351 -2352 -2353 -2354 -2355 -2356 -2357 -2358 -2359 -2360 -2361 -2362 -2363 -2364 -2365 -2366 -2367 -2368 -2369 -2370 -2371 -2372 -2373 -2374 -2375 -2376 -2377 -2378 -2379 -2380 -2381 -2382 -2383 -2384 -2385 -2386 -2387 -2388 -2389 -2390 -2391 -2392 -2393 -2394 -2395 -2396 -2397 -2398 -2399 -2400 -2401 -2402 -2403 -2404 -2405 -2406 -2407 -2408 -2409 -2410 -2411 -2412 -2413 -2414 -2415 -2416 -2417 -2418 -2419 -2420 -2421 -2422 -2423 -2424 -2425 -2426 -2427 -2428 -2429 -2430 -2431 -2432 -2433 -2434 -2435 -2436 -2437 -2438 -2439 -2440 -2441 -2442 -2443 -2444 -2445 -2446 -2447 -2448 -2449 -2450 -2451 -2452 -2453 -2454 -2455 -2456 -2457 -2458 -2459 -2460 -2461 -2462 -2463 -2464 -2465 -2466 -2467 -2468 -2469 -2470 -2471 -2472 -2473 -2474 -2475 -2476 -2477 -2478 -2479 -2480 -2481 -2482 -2483 -2484 -2485 -2486 -2487 -2488 -2489 -2490 -2491 -2492 -2493 -2494 -2495 -2496 -2497 -2498 -2499 -2500 -2501 -2502 -2503 -2504 -2505 -2506 -2507 -2508 -2509 -2510 -2511 -2512 -2513 -2514 -2515 -2516 -2517 -2518 -2519 -2520 -2521 -2522 -2523 -2524 -2525 -2526 -2527 -2528 -2529 -2530 -2531 -2532 -2533 -2534 -2535 -2536 -2537 -2538 -2539 -2540 -2541 -2542 -2543 -2544 -2545 -2546 -2547 -2548 -2549 -2550 -2551 -2552 -2553 -2554 -2555 -2556 -2557 -2558 -2559 -2560 -2561 -2562 -2563 -2564 -2565 -2566 -2567 -2568 -2569 -2570 -2571 -2572 -2573 -2574 -2575 -2576 -2577 -2578 -2579 -2580 -2581 -2582 -2583 -2584 -2585 -2586 -2587 -2588 -2589 -2590 -2591 -2592 -2593 -2594 -2595 -2596 -2597 -2598 -2599 -2600 -2601 -2602 -2603 -2604 -2605 -2606 -2607 -2608 -2609 -2610 -2611 -2612 -2613 -2614 -2615 -2616 -2617 -2618 -2619 -2620 -2621 -2622 -2623 -2624 -2625 -2626 -2627 -2628 -2629 -2630 -2631 -2632 -2633 -2634 -2635 -2636 -2637 -2638 -2639 -2640 -2641 -2642 -2643 -2644 -2645 -2646 -2647 -2648 -2649 -2650 -2651 -2652 -2653 -2654 -2655 -2656 -2657 -2658 -2659 -2660 -2661 -2662 -2663 -2664 -2665 -2666 -2667 -2668 -2669 -2670 -2671 -2672 -2673 -2674 -2675 -2676 -2677 -2678 -2679 -2680 -2681 -2682 -2683 -2684 -2685 -2686 -2687 -2688 -2689 -2690 -2691 -2692 -2693 -2694 -2695 -2696 -2697 -2698 -2699 -2700 -2701 -2702 -2703 -2704 -2705 -2706 -2707 -2708 -2709 -2710 -2711 -2712 -2713 -2714 -2715 -2716 -2717 -2718 -2719 -2720 -2721 -2722 -2723 -2724 -2725 -2726 -2727 -2728 -2729 -2730 -2731 -2732 -2733 -2734 -2735 -2736 -2737 -2738 -2739 -2740 -2741 -2742 -2743 -2744 -2745 -2746 -2747 -2748 -2749 -2750 -2751 -2752 -2753 -2754 -2755 -2756 -2757 -2758 -2759 -2760 -2761 -2762 -2763 -2764 -2765 -2766 -2767 -2768 -2769 -2770 -2771 -2772 -2773 -2774 -2775 -2776 -2777 -2778 -2779 -2780 -2781 -2782 -2783 -2784 -2785 -2786 -2787 -2788 -2789 -2790 -2791 -2792 -2793 -2794 -2795 -2796 -2797 -2798 -2799 -2800 -2801 -2802 -2803 -2804 -2805 -2806 -2807 -2808 -2809 -2810 -2811 -2812 -2813 -2814 -2815 -2816 -2817 -2818 -2819 -2820 -2821 -2822 -2823 -2824 -2825 -2826 -2827 -2828 -2829 -2830 -2831 -2832 -2833 -2834 -2835 -2836 -2837 -2838 -2839 -2840 -2841 -2842 -2843 -2844 -2845 -2846 -2847 -2848 -2849 -2850 -2851 -2852 -2853 -2854 -2855 -2856 -2857 -2858 -2859 -2860 -2861 -2862 -2863 -2864 -2865 -2866 -2867 -2868 -2869 -2870 -2871 -2872 -2873 -2874 -2875 -2876 -2877 -2878 -2879 -2880 -2881 -2882 -2883 -2884 -2885 -2886 -2887 -2888 -2889 -2890 -2891 -2892 -2893 -2894 -2895 -2896 -2897 -2898 -2899 -2900 -2901 -2902 -2903 -2904 -2905 -2906 -2907 -2908 -2909 -2910 -2911 -2912 -2913 -2914 -2915 -2916 -2917 -2918 -2919 -2920 -2921 -2922 -2923 -2924 -2925 -2926 -2927 -2928 -2929 -2930 -2931 -2932 -2933 -2934 -2935 -2936 -2937 -2938 -2939 -2940 -2941 -2942 -2943 -2944 -2945 -2946 -2947 -2948 -2949 -2950 -2951 -2952 -2953 -2954 -2955 -2956 -2957 -2958 -2959 -2960 -2961 -2962 -2963 -2964 -2965 -2966 -2967 -2968 -2969 -2970 -2971 -2972 -2973 -2974 -2975 -2976 -2977 -2978 -2979 -2980 -2981 -2982 -2983 -2984 -2985 -2986 -2987 -2988 -2989 -2990 -2991 -2992 -2993 -2994 -2995 -2996 -2997 -2998 -2999 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3009 -3010 -3011 -3012 -3013 -3014 -3015 -3016 -3017 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3028 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3038 -3039 -3040 -3041 -3042 -3043 -3044 -3045 -3046 -3047 -3048 -3049 -3050 -3051 -3052 -3053 -3054 -3055 -3056 -3057 -3058 -3059 -3060 -3061 -3062 -3063 -3064 -3065 -3066 -3067 -3068 -3069 -3070 -3071 -3072 -3073 -3074 -3075 -3076 -3077 -3078 -3079 -3080 -3081 -3082 -3083 -3084 -3085 -3086 -3087 -3088 -3089 -3090 -3091 -3092 -3093 -3094 -3095 -3096 -3097 -3098 -3099 -3100 -3101 -3102 -3103 -3104 -3105 -3106 -3107 -3108 -3109 -3110 -3111 -3112 -3113 -3114 -3115 -3116 -3117 -3118 -3119 -3120 -3121 -3122 -3123 -3124 -3125 -3126 -3127 -3128 -3129 -3130 -3131 -3132 -3133 -3134 -3135 -3136 -3137 -3138 -3139 -3140 -3141 -3142 -3143 -3144 -3145 -3146 -3147 -3148 -3149 -3150 -3151 -3152 -3153 -3154 -3155 -3156 -3157 -3158 -3159 -3160 -3161 -3162 -3163 -3164 -3165 -3166 -3167 -3168 -3169 -3170 -3171 -3172 -3173 -3174 -3175 -3176 -3177 -3178 -3179 -3180 -3181 -3182 -3183 -3184 -3185 -3186 -3187 -3188 -3189 -3190 -3191 -3192 -3193 -3194 -3195 -3196 -3197 -3198 -3199 -3200 -3201 -3202 -3203 -3204 -3205 -3206 -3207 -3208 -3209 -3210 -3211 -3212 -3213 -3214 -3215 -3216 -3217 -3218 -3219 -3220 -3221 -3222 -3223 -3224 -3225 -3226 -3227 -3228 -3229 -3230 -3231 -3232 -3233 -3234 -3235 -3236 -3237 -3238 -3239 -3240 -3241 -3242 -3243 -3244 -3245 -3246 -3247 -3248 -3249 -3250 -3251 -3252 -3253 -3254 -3255 -3256 -3257 -3258 -3259 -3260 -3261 -3262 -3263 -3264 -3265 -3266 -3267 -3268 -3269 -3270 -3271 -3272 -3273 -3274 -3275 -3276 -3277 -3278 -3279 -3280 -3281 -3282 -3283 -3284 -3285 -3286 -3287 -3288 -3289 -3290 -3291 -3292 -3293 -3294 -3295 -3296 -3297 -3298 -3299 -3300 -3301 -3302 -3303 -3304 -3305 -3306 -3307 -3308 -3309 -3310 -3311 -3312 -3313 -3314 -3315 -3316 -3317 -3318 -3319 -3320 -3321 -3322 -3323 -3324 -3325 -3326 -3327 -3328 -3329 -3330 -3331 -3332 -3333 -3334 -3335 -3336 -3337 -3338 -3339 -3340 -3341 -3342 -3343 -3344 -3345 -3346 -3347 -3348 -3349 -3350 -3351 -3352 -3353 -3354 -3355 -3356 -3357 -3358 -3359 -3360 -3361 -3362 -3363 -3364 -3365 -3366 -3367 -3368 -3369 -3370 -3371 -3372 -3373 -3374 -3375 -3376 -3377 -3378 -3379 -3380 -3381 -3382 -3383 -3384 -3385 -3386 -3387 -3388 -3389 -3390 -3391 -3392 -3393 -3394 -3395 -3396 -3397 -3398 -3399 -3400 -3401 -3402 -3403 -3404 -3405 -3406 -3407 -3408 -3409 -3410 -3411 -3412 -3413 -3414 -3415 -3416 -3417 -3418 -3419 -3420 -3421 -3422 -3423 -3424 -3425 -3426 -3427 -3428 -3429 -3430 -3431 -3432 -3433 -3434 -3435 -3436 -3437 -3438 -3439 -3440 -3441 -3442 -3443 -3444 -3445 -3446 -3447 -3448 -3449 -3450 -3451 -3452 -3453 -3454 -3455 -3456 -3457 -3458 -3459 -3460 -3461 -3462 -3463 -3464 -3465 -3466 -3467 -3468 -3469 -3470 -3471 -3472 -3473 -3474 -3475 -3476 -3477 -3478 -3479 -3480 -3481 -3482 -3483 -3484 -3485 -3486 -3487 -3488 -3489 -3490 -3491 -3492 -3493 -3494 -3495 -3496 -3497 -3498 -3499 -3500 -3501 -3502 -3503 -3504 -3505 -3506 -3507 -3508 -3509 -3510 -3511 -3512 -3513 -3514 -3515 -3516 -3517 -3518 -3519 -3520 -3521 -3522 -3523 -3524 -3525 -3526 -3527 -3528 -3529 -3530 -3531 -3532 -3533 -3534 -3535 -3536 -3537 -3538 -3539 -3540 -3541 -3542 -3543 -3544 -3545 -3546 -3547 -3548 -3549 -3550 -3551 -3552 -3553 -3554 -3555 -3556 -3557 -3558 -3559 -3560 -3561 -3562 -3563 -3564 -3565 -3566 -3567 -3568 -3569 -3570 -3571 -3572 -3573 -3574 -3575 -3576 -3577 -3578 -3579 -3580 -3581 -3582 -3583 -3584 -3585 -3586 -3587 -3588 -3589 -3590 -3591 -3592 -3593 -3594 -3595 -3596 -3597 -3598 -3599 -3600 -3601 -3602 -3603 -3604 -3605 -3606 -3607 -3608 -3609 -3610 -3611 -3612 -3613 -3614 -3615 -3616 -3617 -3618 -3619 -3620 -3621 -3622 -3623 -3624 -3625 -3626 -3627 -3628 -3629 -3630 -3631 -3632 -3633 -3634 -3635 -3636 -3637 -3638 -3639 -3640 -3641 -3642 -3643 -3644 -3645 -3646 -3647 -3648 -3649 -3650 -3651 -3652 -3653 -3654 -3655 -3656 -3657 -3658 -3659 -3660 -3661 -3662 -3663 -3664 -3665 -3666 -3667 -3668 -3669 -3670 -3671 -3672 -3673 -3674 -3675 -3676 -3677 -3678 -3679 -3680 -3681 -3682 -3683 -3684 -3685 -3686 -3687 -3688 -3689 -3690 -3691 -3692 -3693 -3694 -3695 -3696 -3697 -3698 -3699 -3700 -3701 -3702 -3703 -3704 -3705 -3706 -3707 -3708 -3709 -3710 -3711 -3712 -3713 -3714 -3715 -3716 -3717 -3718 -3719 -3720 -3721 -3722 -3723 -3724 -3725 -3726 -3727 -3728 -3729 -3730 -3731 -3732 -3733 -3734 -3735 -3736 -3737 -3738 -3739 -3740 -3741 -3742 -3743 -3744 -3745 -3746 -3747 -3748 -3749 -3750 -3751 -3752 -3753 -3754 -3755 -3756 -3757 -3758 -3759 -3760 -3761 -3762 -3763 -3764 -3765 -3766 -3767 -3768 -3769 -3770 -3771 -3772 -3773 -3774 -3775 -3776 -3777 -3778 -3779 -3780 -3781 -3782 -3783 -3784 -3785 -3786 -3787 -3788 -3789 -3790 -3791 -3792 -3793 -3794 -3795 -3796 -3797 -3798 -3799 -3800 -3801 -3802 -3803 -3804 -3805 -3806 -3807 -3808 -3809 -3810 -3811 -3812 -3813 -3814 -3815 -3816 -3817 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3828 -3829 -3830 -3831 -3832 -3833 -3834 -3835 -3836 -
//!
-//! [](https://crates.io/crates/ubits)
-//! [](https://crates.io/crates/ubits)
-//! [](https://github.com/manoadamro/ubits/actions/workflows/rust.yml)
-//! [](https://manoadamro.github.io/ubits/doc/ubits/)
-//! [](https://github.com/manoadamro/ubits/blob/main/LICENSE)
-//!
-//! Bit fields and masks for rust!
-//!
-//! Provides a macro for generating [`bit field`](https://en.wikipedia.org/wiki/Bit_field) types
-//! complete with flags and some helpful trait implementations.
-//!
-//! Supports field widths of `8`, `16`, `32`, `64` and `128` bits.
-//!
-//! - [`bitfield`] - macro documentation.
-//! - [`examples`] - examples of the output generated by the [`bitfield`] macro.
-//!
-//! __Note: the example module is only complied with documentation builds
-//! and is not available for importing in the wild.__
-//!
-//!
-//! # Usage
-//!
-//! Generate a bitfield struct with a flag enum...
-//! (The following examples all use this as a definition.)
-//! ```rust
-//! use ubits::bitfield;
-//!
-//! bitfield! {
-//! pub u8 ExampleField
-//! ExampleFlags {
-//! 0 : Flag0,
-//! 1 : Flag1,
-//! 2 : Flag2,
-//! 3 : Flag3,
-//! 4 : Flag4,
-//! 5 : Flag5,
-//! 6 : Flag6,
-//! 7 : Flag7,
-//! }
-//! }
-//! ```
-//!
-//! ## Instances
-//!
-//! From integer:
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let from_integer = ExampleField(123);
-//! assert_eq!(ExampleField(123), from_integer);
-//! ```
-//!
-//! From a binary string:
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let from_binary = ExampleField::from_binary_str("01111011");
-//! assert_eq!(ExampleField(123), from_binary)
-//! ```
-//!
-//! From ones:
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let from_ones = ExampleField::ones();
-//! assert_eq!("11111111", from_ones.as_binary());
-//! assert_eq!(255, from_ones.as_integer());
-//! ```
-//!
-//! From zeros:
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let from_zeros = ExampleField::zeros();
-//! assert_eq!("00000000", from_zeros.as_binary());
-//! assert_eq!(0, from_zeros.as_integer());
-//! ```
-//!
-//! ### Field Access
-//!
-//! Get bit value by field:
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let field = ExampleField::from_binary_str("01010101");
-//! assert!(field.get(ExampleFlags::Flag0));
-//! assert!(!field.get(ExampleFlags::Flag1));
-//! ```
-//!
-//! Get bit value by index:
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let field = ExampleField::from_binary_str("01010101");
-//! assert!(field.get_index(0));
-//! assert!(!field.get_index(1));
-//! ```
-//!
-//! Set bit value by field:
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut field = ExampleField::from_binary_str("01010101");
-//! field.set(ExampleFlags::Flag1);
-//! field.set(ExampleFlags::Flag3);
-//! assert_eq!("01011111", field.as_binary());
-//! ```
-//!
-//! Set bit value by index:
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut field = ExampleField::from_binary_str("01010101");
-//! field.set_index(1);
-//! field.set_index(3);
-//! assert_eq!("01011111", field.as_binary());
-//! ```
-//!
-//! Clear bit value by field:
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut field = ExampleField::from_binary_str("01010101");
-//! field.clear(ExampleFlags::Flag0);
-//! field.clear(ExampleFlags::Flag2);
-//! assert_eq!("01010000", field.as_binary());
-//! ```
-//!
-//! Clear bit value by index:
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut field = ExampleField::from_binary_str("01010101");
-//! field.clear_index(0);
-//! field.clear_index(2);
-//! assert_eq!("01010000", field.as_binary());
-//! ```
-//!
-//! Toggle bit value by field:
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut field = ExampleField::from_binary_str("01010101");
-//! field.toggle(ExampleFlags::Flag0);
-//! assert_eq!("01010100", field.as_binary());
-//! field.toggle(ExampleFlags::Flag0);
-//! assert_eq!("01010101", field.as_binary());
-//! ```
-//!
-//! Toggle bit value by index:
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut field = ExampleField::from_binary_str("01010101");
-//! field.toggle_index(0);
-//! assert_eq!("01010100", field.as_binary());
-//! field.toggle_index(0);
-//! assert_eq!("01010101", field.as_binary());
-//! ```
-//!
-//! ### Named Getters and Setters
-//!
-//! Ubits can generate getter and setter methods for zero or more fields, if a name is provided.
-//!
-//! ```rust
-//! use ubits::bitfield;
-//! bitfield! {
-//! pub u8 ExampleField
-//! ExampleFlags {
-//! 0 : Flag0 : (field_0), // is_field_0 & set_field_0 & clear_field_0 & toggle_field_0
-//! 1 : Flag1 : (field_1), // is_field_1 & set_field_1 & clear_field_1 & toggle_field_1
-//! 2 : Flag2,
-//! 3 : Flag3,
-//! 4 : Flag4,
-//! 5 : Flag5,
-//! 6 : Flag6,
-//! 7 : Flag7,
-//! }
-//! }
-//!
-//! let mut field = ExampleField::from_binary_str("01010101");
-//! assert_eq!(true, field.is_field_0());
-//! assert_eq!(false, field.is_field_1());
-//!
-//! field.set_field_1();
-//! assert_eq!(true, field.is_field_1());
-//!
-//! field.clear_field_1();
-//! assert_eq!(false, field.is_field_1());
-//!
-//! field.toggle_field_1();
-//! assert_eq!(true, field.is_field_1());
-//! ```
-//!
-//! ### Combinations
-//!
-//! Combine bit fields: <br>
-//! (use `into_combined` to consume self)
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut a = ExampleField::from_binary_str("01010101");
-//! let b = ExampleField::from_binary_str("10101010");
-//! assert_eq!("11111111", a.combine(b).as_binary());
-//! ```
-//!
-//! Get the intersection of two bitfields: <br>
-//! (use `into_intersection` to consume self)
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut a = ExampleField::from_binary_str("11000011");
-//! let b = ExampleField::from_binary_str("01111110");
-//! assert_eq!("01000010", a.intersect(b).as_binary());
-//! ```
-//!
-//! Get the diff of two bitfields: <br>
-//! (use `into_diff` to consume self)
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut a = ExampleField::from_binary_str("11000011");
-//! let b = ExampleField::from_binary_str("01100110");
-//! assert_eq!("10100101", a.diff(b).as_binary());
-//! ```
-//!
-//! ### Bitwise
-//!
-//! Both bit field instances and flags use bitwise operators to change bit values.
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut from_zeros = ExampleField::zeros();
-//! assert_eq!("00000000", from_zeros.as_binary());
-//!
-//! // set bit to 1
-//! from_zeros |= ExampleFlags::Flag1;
-//! assert_eq!("00000010", from_zeros.as_binary());
-//!
-//! // set bit back to 0
-//! from_zeros &= ExampleFlags::Flag1;
-//! assert_eq!("00000000", from_zeros.as_binary());
-//!
-//! // toggle a bit
-//! from_zeros ^= ExampleFlags::Flag1;
-//! assert_eq!("00000010", from_zeros.as_binary());
-//!
-//! from_zeros ^= ExampleFlags::Flag1;
-//! assert_eq!("00000000", from_zeros.as_binary());
-//! ```
-//!
-//! Operations can also be chained together:
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut from_zeros = ExampleField::zeros() | ExampleFlags::Flag1 | ExampleFlags::Flag3;
-//! assert_eq!("00001010", from_zeros.as_binary());
-//!
-//! ```
-//!
-//! Bitfield instances can also be created from combining flags:
-//!
-//! ```rust
-//! # use ubits::bitfield;
-//! # bitfield! {
-//! # pub u8 ExampleField
-//! # ExampleFlags {
-//! # 0 : Flag0,
-//! # 1 : Flag1,
-//! # 2 : Flag2,
-//! # 3 : Flag3,
-//! # 4 : Flag4,
-//! # 5 : Flag5,
-//! # 6 : Flag6,
-//! # 7 : Flag7,
-//! # }
-//! # }
-//!
-//! let mut from_zeros = ExampleFlags::Flag1 | ExampleFlags::Flag3;
-//! assert_eq!("00001010", from_zeros.as_binary());
-//!
-//! ```
-//!
-//! ## Fields named with flags
-//!
-//! The generated flags enum allows you to access bits by name.
-//! The flag has an associated [`u8`] value,
-//! which determines the index its target bit.
-//! (See [`bitfield`] for more info)
-//!
-//! With the following input...
-//! ```no_compile
-//! 1 0 1 0 0 1 1 0
-//! ```
-//!
-//! and the following flags...
-//! ```no_compile
-//! 0 : f1
-//! 1 : f1
-//! 2 : f2
-//! 3 : f3
-//! 4 : f4
-//! 5 : f5
-//! 6 : f6
-//! 7 : f7
-//! ```
-//!
-//! we end up with this layout.
-//!
-//! | name | f7 | f6 | f5 | f4 | f3 | f2 | f1 | f0 |
-//! |-----------|----|----|----|----|----|----|----|----|
-//! | bit value | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
-//! | index | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
-//!
-//!
-//! With the same input and only the first few flags:
-//!
-//! ```no_compile
-//! 0 : f0
-//! 1 : f1
-//! 2 : f2
-//! ```
-//!
-//! we end up with this layout.
-//!
-//! | name | | | | | | f2 | f1 | f0 |
-//! |-----------|----|----|----|----|----|----|----|----|
-//! | bit value | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
-//! | index | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
-//!
-//!
-//! Using the same input, but with dispersed flags:
-//!
-//! ```no_compile
-//! 1 : f0
-//! 3 : f1
-//! 6 : f2
-//! ```
-//!
-//! we end up with this layout.
-//!
-//! | name | | f2 | | | f1 | | f0 | |
-//! |-----------|----|----|----|----|----|----|----|----|
-//! | bit value | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
-//! | index | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
-//!
-
-// -------------------------------------------------------------------------------------------------
-// Imports
-
-extern crate doc_comment;
-extern crate paste;
-extern crate safe_transmute;
-
-#[doc(hidden)]
-pub use doc_comment::doc_comment as __doc_comment;
-
-#[doc(hidden)]
-pub use safe_transmute::{
- transmute_one as __transmute_one, TriviallyTransmutable as __TriviallyTransmutable,
+lib.rs - source 1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+990
+991
+992
+993
+994
+995
+996
+997
+998
+999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+1679
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+1717
+1718
+1719
+1720
+1721
+1722
+1723
+1724
+1725
+1726
+1727
+1728
+1729
+1730
+1731
+1732
+1733
+1734
+1735
+1736
+1737
+1738
+1739
+1740
+1741
+1742
+1743
+1744
+1745
+1746
+1747
+1748
+1749
+1750
+1751
+1752
+1753
+1754
+1755
+1756
+1757
+1758
+1759
+1760
+1761
+1762
+1763
+1764
+1765
+1766
+1767
+1768
+1769
+1770
+1771
+1772
+1773
+1774
+1775
+1776
+1777
+1778
+1779
+1780
+1781
+1782
+1783
+1784
+1785
+1786
+1787
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+1801
+1802
+1803
+1804
+1805
+1806
+1807
+1808
+1809
+1810
+1811
+1812
+1813
+1814
+1815
+1816
+1817
+1818
+1819
+1820
+1821
+1822
+1823
+1824
+1825
+1826
+1827
+1828
+1829
+1830
+1831
+1832
+1833
+1834
+1835
+1836
+1837
+1838
+1839
+1840
+1841
+1842
+1843
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+1851
+1852
+1853
+1854
+1855
+1856
+1857
+1858
+1859
+1860
+1861
+1862
+1863
+1864
+1865
+1866
+1867
+1868
+1869
+1870
+1871
+1872
+1873
+1874
+1875
+1876
+1877
+1878
+1879
+1880
+1881
+1882
+1883
+1884
+1885
+1886
+1887
+1888
+1889
+1890
+1891
+1892
+1893
+1894
+1895
+1896
+1897
+1898
+1899
+1900
+1901
+1902
+1903
+1904
+1905
+1906
+1907
+1908
+1909
+1910
+1911
+1912
+1913
+1914
+1915
+1916
+1917
+1918
+1919
+1920
+1921
+1922
+1923
+1924
+1925
+1926
+1927
+1928
+1929
+1930
+1931
+1932
+1933
+1934
+1935
+1936
+1937
+1938
+1939
+1940
+1941
+1942
+1943
+1944
+1945
+1946
+1947
+1948
+1949
+1950
+1951
+1952
+1953
+1954
+1955
+1956
+1957
+1958
+1959
+1960
+1961
+1962
+1963
+1964
+1965
+1966
+1967
+1968
+1969
+1970
+1971
+1972
+1973
+1974
+1975
+1976
+1977
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+1998
+1999
+2000
+2001
+2002
+2003
+2004
+2005
+2006
+2007
+2008
+2009
+2010
+2011
+2012
+2013
+2014
+2015
+2016
+2017
+2018
+2019
+2020
+2021
+2022
+2023
+2024
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+2033
+2034
+2035
+2036
+2037
+2038
+2039
+2040
+2041
+2042
+2043
+2044
+2045
+2046
+2047
+2048
+2049
+2050
+2051
+2052
+2053
+2054
+2055
+2056
+2057
+2058
+2059
+2060
+2061
+2062
+2063
+2064
+2065
+2066
+2067
+2068
+2069
+2070
+2071
+2072
+2073
+2074
+2075
+2076
+2077
+2078
+2079
+2080
+2081
+2082
+2083
+2084
+2085
+2086
+2087
+2088
+2089
+2090
+2091
+2092
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
+2101
+2102
+2103
+2104
+2105
+2106
+2107
+2108
+2109
+2110
+2111
+2112
+2113
+2114
+2115
+2116
+2117
+2118
+2119
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+2130
+2131
+2132
+2133
+2134
+2135
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+2148
+2149
+2150
+2151
+2152
+2153
+2154
+2155
+2156
+2157
+2158
+2159
+2160
+2161
+2162
+2163
+2164
+2165
+2166
+2167
+2168
+2169
+2170
+2171
+2172
+2173
+2174
+2175
+2176
+2177
+2178
+2179
+2180
+2181
+2182
+2183
+2184
+2185
+2186
+2187
+2188
+2189
+2190
+2191
+2192
+2193
+2194
+2195
+2196
+2197
+2198
+2199
+2200
+2201
+2202
+2203
+2204
+2205
+2206
+2207
+2208
+2209
+2210
+2211
+2212
+2213
+2214
+2215
+2216
+2217
+2218
+2219
+2220
+2221
+2222
+2223
+2224
+2225
+2226
+2227
+2228
+2229
+2230
+2231
+2232
+2233
+2234
+2235
+2236
+2237
+2238
+2239
+2240
+2241
+2242
+2243
+2244
+2245
+2246
+2247
+2248
+2249
+2250
+2251
+2252
+2253
+2254
+2255
+2256
+2257
+2258
+2259
+2260
+2261
+2262
+2263
+2264
+2265
+2266
+2267
+2268
+2269
+2270
+2271
+2272
+2273
+2274
+2275
+2276
+2277
+2278
+2279
+2280
+2281
+2282
+2283
+2284
+2285
+2286
+2287
+2288
+2289
+2290
+2291
+2292
+2293
+2294
+2295
+2296
+2297
+2298
+2299
+2300
+2301
+2302
+2303
+2304
+2305
+2306
+2307
+2308
+2309
+2310
+2311
+2312
+2313
+2314
+2315
+2316
+2317
+2318
+2319
+2320
+2321
+2322
+2323
+2324
+2325
+2326
+2327
+2328
+2329
+2330
+2331
+2332
+2333
+2334
+2335
+2336
+2337
+2338
+2339
+2340
+2341
+2342
+2343
+2344
+2345
+2346
+2347
+2348
+2349
+2350
+2351
+2352
+2353
+2354
+2355
+2356
+2357
+2358
+2359
+2360
+2361
+2362
+2363
+2364
+2365
+2366
+2367
+2368
+2369
+2370
+2371
+2372
+2373
+2374
+2375
+2376
+2377
+2378
+2379
+2380
+2381
+2382
+2383
+2384
+2385
+2386
+2387
+2388
+2389
+2390
+2391
+2392
+2393
+2394
+2395
+2396
+2397
+2398
+2399
+2400
+2401
+2402
+2403
+2404
+2405
+2406
+2407
+2408
+2409
+2410
+2411
+2412
+2413
+2414
+2415
+2416
+2417
+2418
+2419
+2420
+2421
+2422
+2423
+2424
+2425
+2426
+2427
+2428
+2429
+2430
+2431
+2432
+2433
+2434
+2435
+2436
+2437
+2438
+2439
+2440
+2441
+2442
+2443
+2444
+2445
+2446
+2447
+2448
+2449
+2450
+2451
+2452
+2453
+2454
+2455
+2456
+2457
+2458
+2459
+2460
+2461
+2462
+2463
+2464
+2465
+2466
+2467
+2468
+2469
+2470
+2471
+2472
+2473
+2474
+2475
+2476
+2477
+2478
+2479
+2480
+2481
+2482
+2483
+2484
+2485
+2486
+2487
+2488
+2489
+2490
+2491
+2492
+2493
+2494
+2495
+2496
+2497
+2498
+2499
+2500
+2501
+2502
+2503
+2504
+2505
+2506
+2507
+2508
+2509
+2510
+2511
+2512
+2513
+2514
+2515
+2516
+2517
+2518
+2519
+2520
+2521
+2522
+2523
+2524
+2525
+2526
+2527
+2528
+2529
+2530
+2531
+2532
+2533
+2534
+2535
+2536
+2537
+2538
+2539
+2540
+2541
+2542
+2543
+2544
+2545
+2546
+2547
+2548
+2549
+2550
+2551
+2552
+2553
+2554
+2555
+2556
+2557
+2558
+2559
+2560
+2561
+2562
+2563
+2564
+2565
+2566
+2567
+2568
+2569
+2570
+2571
+2572
+2573
+2574
+2575
+2576
+2577
+2578
+2579
+2580
+2581
+2582
+2583
+2584
+2585
+2586
+2587
+2588
+2589
+2590
+2591
+2592
+2593
+2594
+2595
+2596
+2597
+2598
+2599
+2600
+2601
+2602
+2603
+2604
+2605
+2606
+2607
+2608
+2609
+2610
+2611
+2612
+2613
+2614
+2615
+2616
+2617
+2618
+2619
+2620
+2621
+2622
+2623
+2624
+2625
+2626
+2627
+2628
+2629
+2630
+2631
+2632
+2633
+2634
+2635
+2636
+2637
+2638
+2639
+2640
+2641
+2642
+2643
+2644
+2645
+2646
+2647
+2648
+2649
+2650
+2651
+2652
+2653
+2654
+2655
+2656
+2657
+2658
+2659
+2660
+2661
+2662
+2663
+2664
+2665
+2666
+2667
+2668
+2669
+2670
+2671
+2672
+2673
+2674
+2675
+2676
+2677
+2678
+2679
+2680
+2681
+2682
+2683
+2684
+2685
+2686
+2687
+2688
+2689
+2690
+2691
+2692
+2693
+2694
+2695
+2696
+2697
+2698
+2699
+2700
+2701
+2702
+2703
+2704
+2705
+2706
+2707
+2708
+2709
+2710
+2711
+2712
+2713
+2714
+2715
+2716
+2717
+2718
+2719
+2720
+2721
+2722
+2723
+2724
+2725
+2726
+2727
+2728
+2729
+2730
+2731
+2732
+2733
+2734
+2735
+2736
+2737
+2738
+2739
+2740
+2741
+2742
+2743
+2744
+2745
+2746
+2747
+2748
+2749
+2750
+2751
+2752
+2753
+2754
+2755
+2756
+2757
+2758
+2759
+2760
+2761
+2762
+2763
+2764
+2765
+2766
+2767
+2768
+2769
+2770
+2771
+2772
+2773
+2774
+2775
+2776
+2777
+2778
+2779
+2780
+2781
+2782
+2783
+2784
+2785
+2786
+2787
+2788
+2789
+2790
+2791
+2792
+2793
+2794
+2795
+2796
+2797
+2798
+2799
+2800
+2801
+2802
+2803
+2804
+2805
+2806
+2807
+2808
+2809
+2810
+2811
+2812
+2813
+2814
+2815
+2816
+2817
+2818
+2819
+2820
+2821
+2822
+2823
+2824
+2825
+2826
+2827
+2828
+2829
+2830
+2831
+2832
+2833
+2834
+2835
+2836
+2837
+2838
+2839
+2840
+2841
+2842
+2843
+2844
+2845
+2846
+2847
+2848
+2849
+2850
+2851
+2852
+2853
+2854
+2855
+2856
+2857
+2858
+2859
+2860
+2861
+2862
+2863
+2864
+2865
+2866
+2867
+2868
+2869
+2870
+2871
+2872
+2873
+2874
+2875
+2876
+2877
+2878
+2879
+2880
+2881
+2882
+2883
+2884
+2885
+2886
+2887
+2888
+2889
+2890
+2891
+2892
+2893
+2894
+2895
+2896
+2897
+2898
+2899
+2900
+2901
+2902
+2903
+2904
+2905
+2906
+2907
+2908
+2909
+2910
+2911
+2912
+2913
+2914
+2915
+2916
+2917
+2918
+2919
+2920
+2921
+2922
+2923
+2924
+2925
+2926
+2927
+2928
+2929
+2930
+2931
+2932
+2933
+2934
+2935
+2936
+2937
+2938
+2939
+2940
+2941
+2942
+2943
+2944
+2945
+2946
+2947
+2948
+2949
+2950
+2951
+2952
+2953
+2954
+2955
+2956
+2957
+2958
+2959
+2960
+2961
+2962
+2963
+2964
+2965
+2966
+2967
+2968
+2969
+2970
+2971
+2972
+2973
+2974
+2975
+2976
+2977
+2978
+2979
+2980
+2981
+2982
+2983
+2984
+2985
+2986
+2987
+2988
+2989
+2990
+2991
+2992
+2993
+2994
+2995
+2996
+2997
+2998
+2999
+3000
+3001
+3002
+3003
+3004
+3005
+3006
+3007
+3008
+3009
+3010
+3011
+3012
+3013
+3014
+3015
+3016
+3017
+3018
+3019
+3020
+3021
+3022
+3023
+3024
+3025
+3026
+3027
+3028
+3029
+3030
+3031
+3032
+3033
+3034
+3035
+3036
+3037
+3038
+3039
+3040
+3041
+3042
+3043
+3044
+3045
+3046
+3047
+3048
+3049
+3050
+3051
+3052
+3053
+3054
+3055
+3056
+3057
+3058
+3059
+3060
+3061
+3062
+3063
+3064
+3065
+3066
+3067
+3068
+3069
+3070
+3071
+3072
+3073
+3074
+3075
+3076
+3077
+3078
+3079
+3080
+3081
+3082
+3083
+3084
+3085
+3086
+3087
+3088
+3089
+3090
+3091
+3092
+3093
+3094
+3095
+3096
+3097
+3098
+3099
+3100
+3101
+3102
+3103
+3104
+3105
+3106
+3107
+3108
+3109
+3110
+3111
+3112
+3113
+3114
+3115
+3116
+3117
+3118
+3119
+3120
+3121
+3122
+3123
+3124
+3125
+3126
+3127
+3128
+3129
+3130
+3131
+3132
+3133
+3134
+3135
+3136
+3137
+3138
+3139
+3140
+3141
+3142
+3143
+3144
+3145
+3146
+3147
+3148
+3149
+3150
+3151
+3152
+3153
+3154
+3155
+3156
+3157
+3158
+3159
+3160
+3161
+3162
+3163
+3164
+3165
+3166
+3167
+3168
+3169
+3170
+3171
+3172
+3173
+3174
+3175
+3176
+3177
+3178
+3179
+3180
+3181
+3182
+3183
+3184
+3185
+3186
+3187
+3188
+3189
+3190
+3191
+3192
+3193
+3194
+3195
+3196
+3197
+3198
+3199
+3200
+3201
+3202
+3203
+3204
+3205
+3206
+3207
+3208
+3209
+3210
+3211
+3212
+3213
+3214
+3215
+3216
+3217
+3218
+3219
+3220
+3221
+3222
+3223
+3224
+3225
+3226
+3227
+3228
+3229
+3230
+3231
+3232
+3233
+3234
+3235
+3236
+3237
+3238
+3239
+3240
+3241
+3242
+3243
+3244
+3245
+3246
+3247
+3248
+3249
+3250
+3251
+3252
+3253
+3254
+3255
+3256
+3257
+3258
+3259
+3260
+3261
+3262
+3263
+3264
+3265
+3266
+3267
+3268
+3269
+3270
+3271
+3272
+3273
+3274
+3275
+3276
+3277
+3278
+3279
+3280
+3281
+3282
+3283
+3284
+3285
+3286
+3287
+3288
+3289
+3290
+3291
+3292
+3293
+3294
+3295
+3296
+3297
+3298
+3299
+3300
+3301
+3302
+3303
+3304
+3305
+3306
+3307
+3308
+3309
+3310
+3311
+3312
+3313
+3314
+3315
+3316
+3317
+3318
+3319
+3320
+3321
+3322
+3323
+3324
+3325
+3326
+3327
+3328
+3329
+3330
+3331
+3332
+3333
+3334
+3335
+3336
+3337
+3338
+3339
+3340
+3341
+3342
+3343
+3344
+3345
+3346
+3347
+3348
+3349
+3350
+3351
+3352
+3353
+3354
+3355
+3356
+3357
+3358
+3359
+3360
+3361
+3362
+3363
+3364
+3365
+3366
+3367
+3368
+3369
+3370
+3371
+3372
+3373
+3374
+3375
+3376
+3377
+3378
+3379
+3380
+3381
+3382
+3383
+3384
+3385
+3386
+3387
+3388
+3389
+3390
+3391
+3392
+3393
+3394
+3395
+3396
+3397
+3398
+3399
+3400
+3401
+3402
+3403
+3404
+3405
+3406
+3407
+3408
+3409
+3410
+3411
+3412
+3413
+3414
+3415
+3416
+3417
+3418
+3419
+3420
+3421
+3422
+3423
+3424
+3425
+3426
+3427
+3428
+3429
+3430
+3431
+3432
+3433
+3434
+3435
+3436
+3437
+3438
+3439
+3440
+3441
+3442
+3443
+3444
+3445
+3446
+3447
+3448
+3449
+3450
+3451
+3452
+3453
+3454
+3455
+3456
+3457
+3458
+3459
+3460
+3461
+3462
+3463
+3464
+3465
+3466
+3467
+3468
+3469
+3470
+3471
+3472
+3473
+3474
+3475
+3476
+3477
+3478
+3479
+3480
+3481
+3482
+3483
+3484
+3485
+3486
+3487
+3488
+3489
+3490
+3491
+3492
+3493
+3494
+3495
+3496
+3497
+3498
+3499
+3500
+3501
+3502
+3503
+3504
+3505
+3506
+3507
+3508
+3509
+3510
+3511
+3512
+3513
+3514
+3515
+3516
+3517
+3518
+3519
+3520
+3521
+3522
+3523
+3524
+3525
+3526
+3527
+3528
+3529
+3530
+3531
+3532
+3533
+3534
+3535
+3536
+3537
+3538
+3539
+3540
+3541
+3542
+3543
+3544
+3545
+3546
+3547
+3548
+3549
+3550
+3551
+3552
+3553
+3554
+3555
+3556
+3557
+3558
+3559
+3560
+3561
+3562
+3563
+3564
+3565
+3566
+3567
+3568
+3569
+3570
+3571
+3572
+3573
+3574
+3575
+3576
+3577
+3578
+3579
+3580
+3581
+3582
+3583
+3584
+3585
+3586
+3587
+3588
+3589
+3590
+3591
+3592
+3593
+3594
+3595
+3596
+3597
+3598
+3599
+3600
+3601
+3602
+3603
+3604
+3605
+3606
+3607
+3608
+3609
+3610
+3611
+3612
+3613
+3614
+3615
+3616
+3617
+3618
+3619
+3620
+3621
+3622
+3623
+3624
+3625
+3626
+3627
+3628
+3629
+3630
+3631
+3632
+3633
+3634
+3635
+3636
+3637
+3638
+3639
+3640
+3641
+3642
+3643
+3644
+3645
+3646
+3647
+3648
+3649
+3650
+3651
+3652
+3653
+3654
+3655
+3656
+3657
+3658
+3659
+3660
+3661
+3662
+3663
+3664
+3665
+3666
+3667
+3668
+3669
+3670
+3671
+3672
+3673
+3674
+3675
+3676
+3677
+3678
+3679
+3680
+3681
+3682
+3683
+3684
+3685
+3686
+3687
+3688
+3689
+3690
+3691
+3692
+3693
+3694
+3695
+3696
+3697
+3698
+3699
+3700
+3701
+3702
+3703
+3704
+3705
+3706
+3707
+3708
+3709
+3710
+3711
+3712
+3713
+3714
+3715
+3716
+3717
+3718
+3719
+3720
+3721
+3722
+3723
+3724
+3725
+3726
+3727
+3728
+3729
+3730
+3731
+3732
+3733
+3734
+3735
+3736
+3737
+3738
+3739
+3740
+3741
+3742
+3743
+3744
+3745
+3746
+3747
+3748
+3749
+3750
+3751
+3752
+3753
+3754
+3755
+3756
+3757
+3758
+3759
+3760
+3761
+3762
+3763
+3764
+3765
+3766
+3767
+3768
+3769
+3770
+3771
+3772
+3773
+3774
+3775
+3776
+3777
+3778
+3779
+3780
+3781
+3782
+3783
+3784
+3785
+3786
+3787
+3788
+3789
+3790
+3791
+3792
+3793
+3794
+3795
+3796
+3797
+3798
+3799
+3800
+3801
+3802
+3803
+3804
+3805
+3806
+3807
+3808
+3809
+3810
+3811
+3812
+3813
+3814
+3815
+3816
+3817
+3818
+3819
+3820
+3821
+3822
+3823
+3824
+3825
+3826
+3827
+3828
+3829
+3830
+3831
+3832
+3833
+3834
+3835
+3836
+
//!
+//! [](https://crates.io/crates/ubits)
+//! [](https://crates.io/crates/ubits)
+//! [](https://github.com/manoadamro/ubits/actions/workflows/rust.yml)
+//! [](https://manoadamro.github.io/ubits/doc/ubits/)
+//! [](https://github.com/manoadamro/ubits/blob/main/LICENSE)
+//!
+//! Bit fields and masks for rust!
+//!
+//! Provides a macro for generating [`bit field`](https://en.wikipedia.org/wiki/Bit_field) types
+//! complete with flags and some helpful trait implementations.
+//!
+//! Supports field widths of `8`, `16`, `32`, `64` and `128` bits.
+//!
+//! - [`bitfield`] - macro documentation.
+//! - [`examples`] - examples of the output generated by the [`bitfield`] macro.
+//!
+//! __Note: the example module is only complied with documentation builds
+//! and is not available for importing in the wild.__
+//!
+//!
+//! # Usage
+//!
+//! Generate a bitfield struct with a flag enum...
+//! (The following examples all use this as a definition.)
+//! ```rust
+//! use ubits::bitfield;
+//!
+//! bitfield! {
+//! pub u8 ExampleField
+//! ExampleFlags {
+//! 0 : Flag0,
+//! 1 : Flag1,
+//! 2 : Flag2,
+//! 3 : Flag3,
+//! 4 : Flag4,
+//! 5 : Flag5,
+//! 6 : Flag6,
+//! 7 : Flag7,
+//! }
+//! }
+//! ```
+//!
+//! ## Instances
+//!
+//! From integer:
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let from_integer = ExampleField(123);
+//! assert_eq!(ExampleField(123), from_integer);
+//! ```
+//!
+//! From a binary string:
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let from_binary = ExampleField::from_binary_str("01111011");
+//! assert_eq!(ExampleField(123), from_binary)
+//! ```
+//!
+//! From ones:
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let from_ones = ExampleField::ones();
+//! assert_eq!("11111111", from_ones.as_binary());
+//! assert_eq!(255, from_ones.as_integer());
+//! ```
+//!
+//! From zeros:
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let from_zeros = ExampleField::zeros();
+//! assert_eq!("00000000", from_zeros.as_binary());
+//! assert_eq!(0, from_zeros.as_integer());
+//! ```
+//!
+//! ### Field Access
+//!
+//! Get bit value by field:
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let field = ExampleField::from_binary_str("01010101");
+//! assert!(field.get(ExampleFlags::Flag0));
+//! assert!(!field.get(ExampleFlags::Flag1));
+//! ```
+//!
+//! Get bit value by index:
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let field = ExampleField::from_binary_str("01010101");
+//! assert!(field.get_index(0));
+//! assert!(!field.get_index(1));
+//! ```
+//!
+//! Set bit value by field:
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut field = ExampleField::from_binary_str("01010101");
+//! field.set(ExampleFlags::Flag1);
+//! field.set(ExampleFlags::Flag3);
+//! assert_eq!("01011111", field.as_binary());
+//! ```
+//!
+//! Set bit value by index:
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut field = ExampleField::from_binary_str("01010101");
+//! field.set_index(1);
+//! field.set_index(3);
+//! assert_eq!("01011111", field.as_binary());
+//! ```
+//!
+//! Clear bit value by field:
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut field = ExampleField::from_binary_str("01010101");
+//! field.clear(ExampleFlags::Flag0);
+//! field.clear(ExampleFlags::Flag2);
+//! assert_eq!("01010000", field.as_binary());
+//! ```
+//!
+//! Clear bit value by index:
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut field = ExampleField::from_binary_str("01010101");
+//! field.clear_index(0);
+//! field.clear_index(2);
+//! assert_eq!("01010000", field.as_binary());
+//! ```
+//!
+//! Toggle bit value by field:
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut field = ExampleField::from_binary_str("01010101");
+//! field.toggle(ExampleFlags::Flag0);
+//! assert_eq!("01010100", field.as_binary());
+//! field.toggle(ExampleFlags::Flag0);
+//! assert_eq!("01010101", field.as_binary());
+//! ```
+//!
+//! Toggle bit value by index:
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut field = ExampleField::from_binary_str("01010101");
+//! field.toggle_index(0);
+//! assert_eq!("01010100", field.as_binary());
+//! field.toggle_index(0);
+//! assert_eq!("01010101", field.as_binary());
+//! ```
+//!
+//! ### Named Getters and Setters
+//!
+//! Ubits can generate getter and setter methods for zero or more fields, if a name is provided.
+//!
+//! ```rust
+//! use ubits::bitfield;
+//! bitfield! {
+//! pub u8 ExampleField
+//! ExampleFlags {
+//! 0 : Flag0 : (field_0), // is_field_0 & set_field_0 & clear_field_0 & toggle_field_0
+//! 1 : Flag1 : (field_1), // is_field_1 & set_field_1 & clear_field_1 & toggle_field_1
+//! 2 : Flag2,
+//! 3 : Flag3,
+//! 4 : Flag4,
+//! 5 : Flag5,
+//! 6 : Flag6,
+//! 7 : Flag7,
+//! }
+//! }
+//!
+//! let mut field = ExampleField::from_binary_str("01010101");
+//! assert_eq!(true, field.is_field_0());
+//! assert_eq!(false, field.is_field_1());
+//!
+//! field.set_field_1();
+//! assert_eq!(true, field.is_field_1());
+//!
+//! field.clear_field_1();
+//! assert_eq!(false, field.is_field_1());
+//!
+//! field.toggle_field_1();
+//! assert_eq!(true, field.is_field_1());
+//! ```
+//!
+//! ### Combinations
+//!
+//! Combine bit fields: <br>
+//! (use `into_combined` to consume self)
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut a = ExampleField::from_binary_str("01010101");
+//! let b = ExampleField::from_binary_str("10101010");
+//! assert_eq!("11111111", a.combine(b).as_binary());
+//! ```
+//!
+//! Get the intersection of two bitfields: <br>
+//! (use `into_intersection` to consume self)
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut a = ExampleField::from_binary_str("11000011");
+//! let b = ExampleField::from_binary_str("01111110");
+//! assert_eq!("01000010", a.intersect(b).as_binary());
+//! ```
+//!
+//! Get the diff of two bitfields: <br>
+//! (use `into_diff` to consume self)
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut a = ExampleField::from_binary_str("11000011");
+//! let b = ExampleField::from_binary_str("01100110");
+//! assert_eq!("10100101", a.diff(b).as_binary());
+//! ```
+//!
+//! ### Bitwise
+//!
+//! Both bit field instances and flags use bitwise operators to change bit values.
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut from_zeros = ExampleField::zeros();
+//! assert_eq!("00000000", from_zeros.as_binary());
+//!
+//! // set bit to 1
+//! from_zeros |= ExampleFlags::Flag1;
+//! assert_eq!("00000010", from_zeros.as_binary());
+//!
+//! // set bit back to 0
+//! from_zeros &= ExampleFlags::Flag1;
+//! assert_eq!("00000000", from_zeros.as_binary());
+//!
+//! // toggle a bit
+//! from_zeros ^= ExampleFlags::Flag1;
+//! assert_eq!("00000010", from_zeros.as_binary());
+//!
+//! from_zeros ^= ExampleFlags::Flag1;
+//! assert_eq!("00000000", from_zeros.as_binary());
+//! ```
+//!
+//! Operations can also be chained together:
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut from_zeros = ExampleField::zeros() | ExampleFlags::Flag1 | ExampleFlags::Flag3;
+//! assert_eq!("00001010", from_zeros.as_binary());
+//!
+//! ```
+//!
+//! Bitfield instances can also be created from combining flags:
+//!
+//! ```rust
+//! # use ubits::bitfield;
+//! # bitfield! {
+//! # pub u8 ExampleField
+//! # ExampleFlags {
+//! # 0 : Flag0,
+//! # 1 : Flag1,
+//! # 2 : Flag2,
+//! # 3 : Flag3,
+//! # 4 : Flag4,
+//! # 5 : Flag5,
+//! # 6 : Flag6,
+//! # 7 : Flag7,
+//! # }
+//! # }
+//!
+//! let mut from_zeros = ExampleFlags::Flag1 | ExampleFlags::Flag3;
+//! assert_eq!("00001010", from_zeros.as_binary());
+//!
+//! ```
+//!
+//! ## Fields named with flags
+//!
+//! The generated flags enum allows you to access bits by name.
+//! The flag has an associated [`u8`] value,
+//! which determines the index its target bit.
+//! (See [`bitfield`] for more info)
+//!
+//! With the following input...
+//! ```no_compile
+//! 1 0 1 0 0 1 1 0
+//! ```
+//!
+//! and the following flags...
+//! ```no_compile
+//! 0 : f1
+//! 1 : f1
+//! 2 : f2
+//! 3 : f3
+//! 4 : f4
+//! 5 : f5
+//! 6 : f6
+//! 7 : f7
+//! ```
+//!
+//! we end up with this layout.
+//!
+//! | name | f7 | f6 | f5 | f4 | f3 | f2 | f1 | f0 |
+//! |-----------|----|----|----|----|----|----|----|----|
+//! | bit value | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
+//! | index | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+//!
+//!
+//! With the same input and only the first few flags:
+//!
+//! ```no_compile
+//! 0 : f0
+//! 1 : f1
+//! 2 : f2
+//! ```
+//!
+//! we end up with this layout.
+//!
+//! | name | | | | | | f2 | f1 | f0 |
+//! |-----------|----|----|----|----|----|----|----|----|
+//! | bit value | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
+//! | index | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+//!
+//!
+//! Using the same input, but with dispersed flags:
+//!
+//! ```no_compile
+//! 1 : f0
+//! 3 : f1
+//! 6 : f2
+//! ```
+//!
+//! we end up with this layout.
+//!
+//! | name | | f2 | | | f1 | | f0 | |
+//! |-----------|----|----|----|----|----|----|----|----|
+//! | bit value | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
+//! | index | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+//!
+
+// -------------------------------------------------------------------------------------------------
+// Imports
+
+extern crate doc_comment;
+extern crate paste;
+extern crate safe_transmute;
+
+#[doc(hidden)]
+pub use doc_comment::doc_comment as __doc_comment;
+
+#[doc(hidden)]
+pub use safe_transmute::{
+ transmute_one as __transmute_one, TriviallyTransmutable as __TriviallyTransmutable,
};
-#[doc(hidden)]
-pub use paste::paste as __paste;
-
-// -------------------------------------------------------------------------------------------------
-// Generator Macros
-
-/// Generates a bitfield struct and a corresponding flag enum.
-///
-/// Can be used multiple times in a single codebase
-/// as long as the identifiers are unique or are isolated so as not to clash.
-///
-/// __See the [`examples`] module for examples of the generated output.__
-///
-/// # Args
-///
-/// - `pub` - optional accessor: if provided, both generated items will public.
-/// If omitted, both will be private. <br>
-/// [see here](https://doc.rust-lang.org/reference/visibility-and-privacy.html#visibility-and-privacy) for possible visibility options.
-///
-/// - `ExampleField` - name for the generated bitfield struct.
-/// (results in `struct ExampleField(...)`)
-///
-/// - `ExampleFlags` - name for the generated flag enum.
-/// (results in `enum ExampleFlags { ... }`)
-///
-/// - `u8` - unsigned integer type to use as a bit array. *Must be an unsigned integer* <br>
-/// valid options are: [`u8`],[`u16`], [`u32`], [`u64`], [`u128`], [`usize`]
-///
-/// - `0 : Flag0` - defines each member of the flag enum. <br>
-/// The left hand side must be a [`u8`] `(0..=254)`
-/// and must be less than the number of bits in the underlying unsigned type.
-/// This value determines the index of the target bit within the field. <br>
-/// The right hand side can be any valid identifier (unique to this enum).
-/// These identifiers will be used to access the corresponding field.
-///
-/// - `/// docstrings` - Each element can take optional docstrings.
-/// This includes the bit field struct, the flag enum, and each member within the flag enum.
-/// See [`examples`] for more information.
-///
-/// # Examples:
-///
-/// Full Example - (see below for explanation for each parameter):
-/// ```rust
-/// use ubits::bitfield;
-///
-/// bitfield! {
-/// /// Optional docstring
-/// /// for [`ExampleField`] struct
-/// pub u8 ExampleField
-/// /// Optional docstring
-/// /// for [`ExampleFlags`] enum
-/// ExampleFlags {
-/// /// Optional docstring for [`ExampleFlags::Flag0`]
-/// 0 : Flag0,
-/// /// Optional docstring for [`ExampleFlags::Flag1`]
-/// 1 : Flag1,
-/// /// Optional docstring for [`ExampleFlags::Flag2`]
-/// 2 : Flag2,
-/// /// Optional docstring for [`ExampleFlags::Flag3`]
-/// 3 : Flag3,
-/// /// Optional docstring for [`ExampleFlags::Flag4`]
-/// 4 : Flag4,
-/// /// Optional docstring for [`ExampleFlags::Flag5`]
-/// 5 : Flag5,
-/// /// Optional docstring for [`ExampleFlags::Flag6`]
-/// 6 : Flag6,
-/// /// Optional docstring for [`ExampleFlags::Flag7`]
-/// 7 : Flag7,
-/// }
-/// }
-/// ```
-///
-/// You don't have to name *all* the fields if you don't need them...
-///
-/// You can use just a few from the front:
-/// ```rust
-/// use ubits::bitfield;
-///
-/// bitfield! {
-/// /// Optional docstring
-/// /// for [`ExampleField`] struct
-/// pub u8 ExampleField
-/// /// Optional docstring
-/// /// for [`ExampleFlags`] enum
-/// ExampleFlags {
-/// /// Optional docstring for [`ExampleFlags::Flag0`]
-/// 0 : Flag0,
-/// /// Optional docstring for [`ExampleFlags::Flag1`]
-/// 1 : Flag1,
-/// /// Optional docstring for [`ExampleFlags::Flag2`]
-/// 2 : Flag2,
-/// }
-/// }
-/// ```
-///
-/// ... or any valid indices:
-/// ```rust
-/// use ubits::bitfield;
-///
-/// bitfield! {
-/// /// Optional docstring
-/// /// for [`ExampleField`] struct
-/// pub u8 ExampleField
-/// /// Optional docstring
-/// /// for [`ExampleFlags`] enum
-/// ExampleFlags {
-/// /// Optional docstring for [`ExampleFlags::Flag0`]
-/// 0 : Flag0,
-/// /// Optional docstring for [`ExampleFlags::Flag1`]
-/// 3 : Flag1,
-/// /// Optional docstring for [`ExampleFlags::Flag2`]
-/// 6 : Flag2,
-/// }
-/// }
-/// ```
-/// ... or just omit the flags altogether and use indices only.:
-/// ```rust
-/// use ubits::bitfield;
-/// bitfield! {
-/// /// Optional docstring
-/// /// for [`ExampleField`] struct
-/// pub u8 ExampleField
-/// }
-/// ```
-/// __Note: if you omit flags, no flag enum will be generated
-/// and no methods for the bitfield struct that rely on flags will be generated.__
-///
-#[macro_export(local_inner_macros)]
-macro_rules! bitfield {
-
- // U8
- (
- $(#[$doc:meta])*
- $access:vis u8 $name:ident
+#[doc(hidden)]
+pub use paste::paste as __paste;
+
+// -------------------------------------------------------------------------------------------------
+// Generator Macros
+
+/// Generates a bitfield struct and a corresponding flag enum.
+///
+/// Can be used multiple times in a single codebase
+/// as long as the identifiers are unique or are isolated so as not to clash.
+///
+/// __See the [`examples`] module for examples of the generated output.__
+///
+/// # Args
+///
+/// - `pub` - optional accessor: if provided, both generated items will public.
+/// If omitted, both will be private. <br>
+/// [see here](https://doc.rust-lang.org/reference/visibility-and-privacy.html#visibility-and-privacy) for possible visibility options.
+///
+/// - `ExampleField` - name for the generated bitfield struct.
+/// (results in `struct ExampleField(...)`)
+///
+/// - `ExampleFlags` - name for the generated flag enum.
+/// (results in `enum ExampleFlags { ... }`)
+///
+/// - `u8` - unsigned integer type to use as a bit array. *Must be an unsigned integer* <br>
+/// valid options are: [`u8`],[`u16`], [`u32`], [`u64`], [`u128`], [`usize`]
+///
+/// - `0 : Flag0` - defines each member of the flag enum. <br>
+/// The left hand side must be a [`u8`] `(0..=254)`
+/// and must be less than the number of bits in the underlying unsigned type.
+/// This value determines the index of the target bit within the field. <br>
+/// The right hand side can be any valid identifier (unique to this enum).
+/// These identifiers will be used to access the corresponding field.
+///
+/// - `/// docstrings` - Each element can take optional docstrings.
+/// This includes the bit field struct, the flag enum, and each member within the flag enum.
+/// See [`examples`] for more information.
+///
+/// # Examples:
+///
+/// Full Example - (see below for explanation for each parameter):
+/// ```rust
+/// use ubits::bitfield;
+///
+/// bitfield! {
+/// /// Optional docstring
+/// /// for [`ExampleField`] struct
+/// pub u8 ExampleField
+/// /// Optional docstring
+/// /// for [`ExampleFlags`] enum
+/// ExampleFlags {
+/// /// Optional docstring for [`ExampleFlags::Flag0`]
+/// 0 : Flag0,
+/// /// Optional docstring for [`ExampleFlags::Flag1`]
+/// 1 : Flag1,
+/// /// Optional docstring for [`ExampleFlags::Flag2`]
+/// 2 : Flag2,
+/// /// Optional docstring for [`ExampleFlags::Flag3`]
+/// 3 : Flag3,
+/// /// Optional docstring for [`ExampleFlags::Flag4`]
+/// 4 : Flag4,
+/// /// Optional docstring for [`ExampleFlags::Flag5`]
+/// 5 : Flag5,
+/// /// Optional docstring for [`ExampleFlags::Flag6`]
+/// 6 : Flag6,
+/// /// Optional docstring for [`ExampleFlags::Flag7`]
+/// 7 : Flag7,
+/// }
+/// }
+/// ```
+///
+/// You don't have to name *all* the fields if you don't need them...
+///
+/// You can use just a few from the front:
+/// ```rust
+/// use ubits::bitfield;
+///
+/// bitfield! {
+/// /// Optional docstring
+/// /// for [`ExampleField`] struct
+/// pub u8 ExampleField
+/// /// Optional docstring
+/// /// for [`ExampleFlags`] enum
+/// ExampleFlags {
+/// /// Optional docstring for [`ExampleFlags::Flag0`]
+/// 0 : Flag0,
+/// /// Optional docstring for [`ExampleFlags::Flag1`]
+/// 1 : Flag1,
+/// /// Optional docstring for [`ExampleFlags::Flag2`]
+/// 2 : Flag2,
+/// }
+/// }
+/// ```
+///
+/// ... or any valid indices:
+/// ```rust
+/// use ubits::bitfield;
+///
+/// bitfield! {
+/// /// Optional docstring
+/// /// for [`ExampleField`] struct
+/// pub u8 ExampleField
+/// /// Optional docstring
+/// /// for [`ExampleFlags`] enum
+/// ExampleFlags {
+/// /// Optional docstring for [`ExampleFlags::Flag0`]
+/// 0 : Flag0,
+/// /// Optional docstring for [`ExampleFlags::Flag1`]
+/// 3 : Flag1,
+/// /// Optional docstring for [`ExampleFlags::Flag2`]
+/// 6 : Flag2,
+/// }
+/// }
+/// ```
+/// ... or just omit the flags altogether and use indices only.:
+/// ```rust
+/// use ubits::bitfield;
+/// bitfield! {
+/// /// Optional docstring
+/// /// for [`ExampleField`] struct
+/// pub u8 ExampleField
+/// }
+/// ```
+/// __Note: if you omit flags, no flag enum will be generated
+/// and no methods for the bitfield struct that rely on flags will be generated.__
+///
+#[macro_export(local_inner_macros)]
+macro_rules! bitfield {
+
+ // U8
+ (
+ $(#[$doc:meta])*
+ $access:vis u8 $name:ident
$(
- $(#[$flag_doc:meta])*
- $flag:ident {
+ $(#[$flag_doc:meta])*
+ $flag:ident {
$(
- $(#[$member_doc:meta])*
- $idx:literal : $field:ident $( : ( $named_getter:ident ) )?,
- )*
+ $(#[$member_doc:meta])*
+ $idx:literal : $field:ident $( : ( $named_getter:ident ) )?,
+ )*
}
- )?
- ) => {
- __bitfield_unchecked!( $(#[$doc])* $access [u8] [8] [u8::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
+ )?
+ ) => {
+ __bitfield_unchecked!( $(#[$doc])* $access [u8] [8] [u8::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
};
- // U16
- (
- $(#[$doc:meta])*
- $access:vis u16 $name:ident
+ // U16
+ (
+ $(#[$doc:meta])*
+ $access:vis u16 $name:ident
$(
- $(#[$flag_doc:meta])*
- $flag:ident {
+ $(#[$flag_doc:meta])*
+ $flag:ident {
$(
- $(#[$member_doc:meta])*
- $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
- )*
+ $(#[$member_doc:meta])*
+ $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
+ )*
}
- )?
- ) => {
- __bitfield_unchecked!( $(#[$doc])* $access [u16] [16] [u16::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
+ )?
+ ) => {
+ __bitfield_unchecked!( $(#[$doc])* $access [u16] [16] [u16::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
};
- // U32
- (
- $(#[$doc:meta])*
- $access:vis u32 $name:ident
+ // U32
+ (
+ $(#[$doc:meta])*
+ $access:vis u32 $name:ident
$(
- $(#[$flag_doc:meta])*
- $flag:ident {
+ $(#[$flag_doc:meta])*
+ $flag:ident {
$(
- $(#[$member_doc:meta])*
- $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
- )*
+ $(#[$member_doc:meta])*
+ $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
+ )*
}
- )?
- ) => {
- __bitfield_unchecked!( $(#[$doc])* $access [u32] [32] [u32::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
+ )?
+ ) => {
+ __bitfield_unchecked!( $(#[$doc])* $access [u32] [32] [u32::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
};
- // U64
- (
- $(#[$doc:meta])*
- $access:vis u64 $name:ident
+ // U64
+ (
+ $(#[$doc:meta])*
+ $access:vis u64 $name:ident
$(
- $(#[$flag_doc:meta])*
- $flag:ident {
+ $(#[$flag_doc:meta])*
+ $flag:ident {
$(
- $(#[$member_doc:meta])*
- $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
- )*
+ $(#[$member_doc:meta])*
+ $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
+ )*
}
- )?
- ) => {
- __bitfield_unchecked!( $(#[$doc])* $access [u64] [64] [u64::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
+ )?
+ ) => {
+ __bitfield_unchecked!( $(#[$doc])* $access [u64] [64] [u64::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
};
- // U128
- (
- $(#[$doc:meta])*
- $access:vis u128 $name:ident
+ // U128
+ (
+ $(#[$doc:meta])*
+ $access:vis u128 $name:ident
$(
- $(#[$flag_doc:meta])*
- $flag:ident {
+ $(#[$flag_doc:meta])*
+ $flag:ident {
$(
- $(#[$member_doc:meta])*
- $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
- )*
+ $(#[$member_doc:meta])*
+ $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
+ )*
}
- )?
- ) => {
- __bitfield_unchecked!( $(#[$doc])* $access [u128] [128] [u128::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
+ )?
+ ) => {
+ __bitfield_unchecked!( $(#[$doc])* $access [u128] [128] [u128::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
};
- // USIZE
- (
- $(#[$doc:meta])*
- $access:vis usize $name:ident
+ // USIZE
+ (
+ $(#[$doc:meta])*
+ $access:vis usize $name:ident
$(
- $(#[$flag_doc:meta])*
- $flag:ident {
+ $(#[$flag_doc:meta])*
+ $flag:ident {
$(
- $(#[$member_doc:meta])*
- $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
- )*
+ $(#[$member_doc:meta])*
+ $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
+ )*
}
- )?
- ) => {
- __bitfield_unchecked!( $(#[$doc])* $access [usize] [usize::BITS as usize] [usize::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
+ )?
+ ) => {
+ __bitfield_unchecked!( $(#[$doc])* $access [usize] [usize::BITS as usize] [usize::MAX] $name $($(#[$flag_doc])* $flag { $( $(#[$member_doc])* $idx : $field $(($named_getter))?, )* } )?);
};
}
-/// Not to be used directly.
-///
-/// Generates a bitfield struct and flag enum
-/// but does no type checking.
-/// Passing types that aren't unsigned integer types is undefined behaviour.
-///
-/// Use the [`bitfield`] macro instead as it enforces a closed set of types.
-#[doc(hidden)]
-#[macro_export(local_inner_macros)]
-macro_rules! __bitfield_unchecked {
+/// Not to be used directly.
+///
+/// Generates a bitfield struct and flag enum
+/// but does no type checking.
+/// Passing types that aren't unsigned integer types is undefined behaviour.
+///
+/// Use the [`bitfield`] macro instead as it enforces a closed set of types.
+#[doc(hidden)]
+#[macro_export(local_inner_macros)]
+macro_rules! __bitfield_unchecked {
(
- $(#[$field_doc:meta])*
- $access:vis [$type:ty] [$($bits:tt)*] [$max:path] $name:ident
+ $(#[$field_doc:meta])*
+ $access:vis [$type:ty] [$($bits:tt)*] [$max:path] $name:ident
$(
- $(#[$flag_doc:meta])*
- $flag:ident {
+ $(#[$flag_doc:meta])*
+ $flag:ident {
$(
- $(#[$member_doc:meta])*
- $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
- )*
+ $(#[$member_doc:meta])*
+ $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
+ )*
}
- )?
- ) => {
+ )?
+ ) => {
$(
- __def_flag_enum! {
- $(#[$flag_doc])*
- $access $name
- $flag {
+ __def_flag_enum! {
+ $(#[$flag_doc])*
+ $access $name
+ $flag {
$(
- $(#[$member_doc])*
- $idx : $field $(($named_getter))?,
- )*
+ $(#[$member_doc])*
+ $idx : $field $(($named_getter))?,
+ )*
}
}
- )?
+ )?
- __def_field_struct! {
- $(#[$field_doc])*
- $access [$type] [$($bits)*] [$max] $name
- $(
- $flag {
+ __def_field_struct! {
+ $(#[$field_doc])*
+ $access [$type] [$($bits)*] [$max] $name
+ $(
+ $flag {
$(
- $(#[$member_doc])*
- $idx : $field $(($named_getter))?,
- )*
+ $(#[$member_doc])*
+ $idx : $field $(($named_getter))?,
+ )*
}
- )?
- }
+ )?
+ }
};
}
-// -------------------------------------------------------------------------------------------------
-// Type Definitions
+// -------------------------------------------------------------------------------------------------
+// Type Definitions
-/// Defines a field struct with its members and implementations
-#[doc(hidden)]
-#[macro_export(local_inner_macros)]
-macro_rules! __def_field_struct {
+/// Defines a field struct with its members and implementations
+#[doc(hidden)]
+#[macro_export(local_inner_macros)]
+macro_rules! __def_field_struct {
(
- $(#[$field_doc:meta])*
- $access:vis [$type:ty] [$($bits:tt)*] [$max:path] $name:ident
+ $(#[$field_doc:meta])*
+ $access:vis [$type:ty] [$($bits:tt)*] [$max:path] $name:ident
$(
- $flag:ident {
+ $flag:ident {
$(
- $(#[$member_doc:meta])*
- $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
- )*
+ $(#[$member_doc:meta])*
+ $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
+ )*
}
- )?
- ) => {
+ )?
+ ) => {
- // Struct: $name
- $(#[$field_doc])*
- #[derive(Copy, Clone, PartialEq, PartialOrd)]
- $access struct $name($type);
+ // Struct: $name
+ $(#[$field_doc])*
+ #[derive(Copy, Clone, PartialEq, PartialOrd)]
+ $access struct $name($type);
$(
- impl $name {
+ impl $name {
$(
$(
- __paste! {
- fn [< is_ $named_getter >](&self) -> bool {
- self.get($flag::$field)
+ __paste! {
+ pub fn [< is_ $named_getter >](&self) -> bool {
+ self.get($flag::$field)
}
}
- __paste! {
- fn [< set_ $named_getter >](&mut self) {
- self.set($flag::$field);
+ __paste! {
+ pub fn [< set_ $named_getter >](&mut self) {
+ self.set($flag::$field);
}
}
- __paste! {
- fn [< clear_ $named_getter >](&mut self) {
- self.clear($flag::$field);
+ __paste! {
+ pub fn [< clear_ $named_getter >](&mut self) {
+ self.clear($flag::$field);
}
}
- __paste! {
- fn [< toggle_ $named_getter >](&mut self) {
- self.toggle($flag::$field);
+ __paste! {
+ pub fn [< toggle_ $named_getter >](&mut self) {
+ self.toggle($flag::$field);
}
}
- )?
- )*
+ )?
+ )*
}
- )?
+ )?
- // Constants
- __impl_field_constants! {
- $name { type: $type, max: $max, bits: [$($bits)*] }
+ // Constants
+ __impl_field_constants! {
+ $name { type: $type, max: $max, bits: [$($bits)*] }
}
- // Constructors
- __impl_field_ctors! {
- $name : $type
- }
+ // Constructors
+ __impl_field_ctors! {
+ $name : $type
+ }
- // State
- __impl_field_state! {
- $name : $type
- }
+ // State
+ __impl_field_state! {
+ $name : $type
+ }
- // Indexers
- __impl_field_index_accessors! {
- $name
- }
+ // Indexers
+ __impl_field_index_accessors! {
+ $name
+ }
$(
- // Flags
- __impl_field_flag_accessors! {
- $name $flag $type
- }
- )?
+ // Flags
+ __impl_field_flag_accessors! {
+ $name $flag $type
+ }
+ )?
- // Combinators
- __impl_field_flag_combinators! {
- $name
- }
+ // Combinators
+ __impl_field_flag_combinators! {
+ $name
+ }
- // Converters
- __impl_field_flag_converters! {
- $name
- }
+ // Converters
+ __impl_field_flag_converters! {
+ $name
+ }
- // Name: $name
- __impl_default! {
- $name => { $name(0) }
+ // Name: $name
+ __impl_default! {
+ $name => { $name(0) }
}
- // From: $type -> $name
- __impl_from! {
- /// Returns a field instance from value of its underlying type.
- $type as $name (value) => {
- $name(value)
+ // From: $type -> $name
+ __impl_from! {
+ /// Returns a field instance from value of its underlying type.
+ $type as $name (value) => {
+ $name(value)
}
}
$(
- // From: $flag -> $name
- __impl_from! {
- /// Returns a field instance from a flag.
- $flag as $name (value) => {
- Self(0 | (1 << (value as $type)) )
+ // From: $flag -> $name
+ __impl_from! {
+ /// Returns a field instance from a flag.
+ $flag as $name (value) => {
+ Self(0 | (1 << (value as $type)) )
}
}
- )?
+ )?
- // Bitwise: $name + $name
- __impl_bitwise_operators! {
- [Self] for $name : (self rhs -> Self)
- BitAnd => { Self(self.0 & rhs.0) }
- BitOr => { Self(self.0 | rhs.0) }
- BitXor => { Self(self.0 ^ rhs.0) }
- BitAndAssign => { self.0 &= rhs.0; }
- BitOrAssign => { self.0 |= rhs.0; }
- BitXorAssign => { self.0 ^= rhs.0; }
+ // Bitwise: $name + $name
+ __impl_bitwise_operators! {
+ [Self] for $name : (self rhs -> Self)
+ BitAnd => { Self(self.0 & rhs.0) }
+ BitOr => { Self(self.0 | rhs.0) }
+ BitXor => { Self(self.0 ^ rhs.0) }
+ BitAndAssign => { self.0 &= rhs.0; }
+ BitOrAssign => { self.0 |= rhs.0; }
+ BitXorAssign => { self.0 ^= rhs.0; }
}
$(
- // Bitwise: $name + $flag
- __impl_bitwise_operators! {
- [$flag] for $name : (self rhs -> $name)
- BitAnd => { $name(self.0 & !(1 << (rhs as $type))) }
- BitOr => { $name(self.0 | (1 << (rhs as $type))) }
- BitXor => { $name(self.0 ^ (1 << (rhs as $type))) }
- BitAndAssign => { self.clear(rhs); }
- BitOrAssign => { self.set(rhs); }
- BitXorAssign => { self.toggle(rhs); }
+ // Bitwise: $name + $flag
+ __impl_bitwise_operators! {
+ [$flag] for $name : (self rhs -> $name)
+ BitAnd => { $name(self.0 & !(1 << (rhs as $type))) }
+ BitOr => { $name(self.0 | (1 << (rhs as $type))) }
+ BitXor => { $name(self.0 ^ (1 << (rhs as $type))) }
+ BitAndAssign => { self.clear(rhs); }
+ BitOrAssign => { self.set(rhs); }
+ BitXorAssign => { self.toggle(rhs); }
}
- // Bitwise: &$name + $flag
- __impl_bitwise_operators! {
- [$flag] for & $name : (self rhs -> $name)
- BitAnd => { $name(self.0 & !(1 << (rhs as $type))) }
- BitOr => { $name(self.0 | (1 << (rhs as $type))) }
- BitXor => { $name(self.0 ^ (1 << (rhs as $type))) }
+ // Bitwise: &$name + $flag
+ __impl_bitwise_operators! {
+ [$flag] for & $name : (self rhs -> $name)
+ BitAnd => { $name(self.0 & !(1 << (rhs as $type))) }
+ BitOr => { $name(self.0 | (1 << (rhs as $type))) }
+ BitXor => { $name(self.0 ^ (1 << (rhs as $type))) }
}
- // Bitwise: $mut $name + $flag
- __impl_bitwise_operators! {
- [$flag] for &mut $name : (self rhs -> $name)
- BitAnd => { $name(self.0 & !(1 << (rhs as $type))) }
- BitOr => { $name(self.0 | (1 << (rhs as $type))) }
- BitXor => { $name(self.0 ^ (1 << (rhs as $type))) }
+ // Bitwise: $mut $name + $flag
+ __impl_bitwise_operators! {
+ [$flag] for &mut $name : (self rhs -> $name)
+ BitAnd => { $name(self.0 & !(1 << (rhs as $type))) }
+ BitOr => { $name(self.0 | (1 << (rhs as $type))) }
+ BitXor => { $name(self.0 ^ (1 << (rhs as $type))) }
}
- )?
+ )?
- // Bitwise: Debug & Binary
- __impl_formatters! {
- $name (self f) {
- Debug => { core::write!(f, "{}({})", core::stringify!($name), self.as_binary()) }
- Binary => { core::write!(f, "{}", self.as_binary()) }
+ // Bitwise: Debug & Binary
+ __impl_formatters! {
+ $name (self f) {
+ Debug => { core::write!(f, "{}({})", core::stringify!($name), self.as_binary()) }
+ Binary => { core::write!(f, "{}", self.as_binary()) }
}
}
};
}
-/// Defines a flag enum with its members and implementations
-#[doc(hidden)]
-#[macro_export(local_inner_macros)]
-macro_rules! __def_flag_enum {
+/// Defines a flag enum with its members and implementations
+#[doc(hidden)]
+#[macro_export(local_inner_macros)]
+macro_rules! __def_flag_enum {
(
- $(#[$flag_doc:meta])*
- $access:vis $name:ident
- $flag:ident {
+ $(#[$flag_doc:meta])*
+ $access:vis $name:ident
+ $flag:ident {
$(
- $(#[$member_doc:meta])*
- $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
- )*
+ $(#[$member_doc:meta])*
+ $idx:literal : $field:ident $( ( $named_getter:ident ) )?,
+ )*
}
) => {
- // Enum: $flag
- $(#[$flag_doc])*
- #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
- #[repr(u8)]
- $access enum $flag {
- $( $(#[$member_doc])* $field = $idx ),*
- }
-
- // Bitwise: $flag + $flag
- __impl_bitwise_operators! {
- [Self] for $flag : (self rhs -> $name)
- BitAnd => { $name(0).clear(self) & rhs }
- BitOr => { $name(0).set(self) | rhs }
- BitXor => { $name(0).toggle(self) ^ rhs }
- }
-
- // Bitwise: u8 -> $flag
- __impl_from! {
- /// Converts a [`u8`] to a flag
- ///
- /// # Errors
- ///
- /// Panics if the supplied [`u8`] is out of range for fields base type.
- /// eg: for a 16-bit field (using [`u16`]),
- /// providing an index of `20` will cause a panic.
- u8 as $flag (value) => {
- $crate::__transmute_one::<$flag>(&[value])
- .expect(std::format!(
+ // Enum: $flag
+ $(#[$flag_doc])*
+ #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
+ #[repr(u8)]
+ $access enum $flag {
+ $( $(#[$member_doc])* $field = $idx ),*
+ }
+
+ // Bitwise: $flag + $flag
+ __impl_bitwise_operators! {
+ [Self] for $flag : (self rhs -> $name)
+ BitAnd => { $name(0).clear(self) & rhs }
+ BitOr => { $name(0).set(self) | rhs }
+ BitXor => { $name(0).toggle(self) ^ rhs }
+ }
+
+ // Bitwise: u8 -> $flag
+ __impl_from! {
+ /// Converts a [`u8`] to a flag
+ ///
+ /// # Errors
+ ///
+ /// Panics if the supplied [`u8`] is out of range for fields base type.
+ /// eg: for a 16-bit field (using [`u16`]),
+ /// providing an index of `20` will cause a panic.
+ u8 as $flag (value) => {
+ $crate::__transmute_one::<$flag>(&[value])
+ .expect(std::format!(
"failed to transmute {} to {}. {} is not a valid index in {}.",
- value,
- core::stringify!($flag),
- value,
- core::stringify!($flag)
- ).as_str())
+ value,
+ core::stringify!($flag),
+ value,
+ core::stringify!($flag)
+ ).as_str())
}
}
- // Bitwise: $flag -> u8
- __impl_from! {
- /// Returns a flag as its corresponding [`u8`] value.
- $flag as u8 (value) => {
- value as u8
+ // Bitwise: $flag -> u8
+ __impl_from! {
+ /// Returns a flag as its corresponding [`u8`] value.
+ $flag as u8 (value) => {
+ value as u8
}
}
- unsafe impl $crate::__TriviallyTransmutable for $flag {}
+ unsafe impl $crate::__TriviallyTransmutable for $flag {}
};
}
-// -------------------------------------------------------------------------------------------------
-// Field Implementations
+// -------------------------------------------------------------------------------------------------
+// Field Implementations
-/// Generates constants for `$name`
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_field_constants {
- ($name:ident { type: $type:ty, max: $max:path, bits: [$($bits:tt)*] }) => {
- $crate::__doc_comment! {
+/// Generates constants for `$name`
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_field_constants {
+ ($name:ident { type: $type:ty, max: $max:path, bits: [$($bits:tt)*] }) => {
+ $crate::__doc_comment! {
core::concat!(
- "Constant values describing [`", core::stringify!($name), "`]."
- ),
- impl $name {
- $crate::__doc_comment! {
+ "Constant values describing [`", core::stringify!($name), "`]."
+ ),
+ impl $name {
+ $crate::__doc_comment! {
core::concat!(
- "Number of bits in an instance of [`", core::stringify!($name), "`]."
- ),
- pub const BITS: usize = $($bits)*;
+ "Number of bits in an instance of [`", core::stringify!($name), "`]."
+ ),
+ pub const BITS: usize = $($bits)*;
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Number of bytes used by an instance of [`", core::stringify!($name), "`]."
- ),
- pub const BYTES: usize = $($bits)* / 8;
+ "Number of bytes used by an instance of [`", core::stringify!($name), "`]."
+ ),
+ pub const BYTES: usize = $($bits)* / 8;
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Maximum valid integer for [`", core::stringify!($name), "`]."
- ),
- pub const MAX: $type = $max;
+ "Maximum valid integer for [`", core::stringify!($name), "`]."
+ ),
+ pub const MAX: $type = $max;
}
}
}
};
}
-/// Generates constructors for `$name`
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_field_ctors {
- ( $name:ident : $type:ty ) => {
- $crate::__doc_comment! {
+/// Generates constructors for `$name`
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_field_ctors {
+ ( $name:ident : $type:ty ) => {
+ $crate::__doc_comment! {
core::concat!(
- "Constructors for creating instances of [`", core::stringify!($name), "`]."
- ),
- impl $name {
- $crate::__doc_comment! {
+ "Constructors for creating instances of [`", core::stringify!($name), "`]."
+ ),
+ impl $name {
+ $crate::__doc_comment! {
core::concat!(
- "Create a new instance of [`", core::stringify!($name), "`] ",
- "from a [`", core::stringify!($type), "`] value."
- ),
- pub fn new(value: $type) -> Self {
- Self(value)
+ "Create a new instance of [`", core::stringify!($name), "`] ",
+ "from a [`", core::stringify!($type), "`] value."
+ ),
+ pub fn new(value: $type) -> Self {
+ Self(value)
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Create a new instance of [`", core::stringify!($name), "`] ",
- "from `0`."
- ),
- pub fn zeros() -> Self {
+ "Create a new instance of [`", core::stringify!($name), "`] ",
+ "from `0`."
+ ),
+ pub fn zeros() -> Self {
Self(0)
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Create a new instance of [`", core::stringify!($name), "`] ",
- "from the maximum possible integer value."
- ),
- pub fn ones() -> Self {
- Self(Self::MAX)
+ "Create a new instance of [`", core::stringify!($name), "`] ",
+ "from the maximum possible integer value."
+ ),
+ pub fn ones() -> Self {
+ Self(Self::MAX)
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Create a new instance of [`", core::stringify!($name), "`] ",
- "from a binary string."
- ),
- pub fn from_binary_str(value: &str) -> Self {
- Self(<$type>::from_str_radix(value, 2).unwrap())
+ "Create a new instance of [`", core::stringify!($name), "`] ",
+ "from a binary string."
+ ),
+ pub fn from_binary_str(value: &str) -> Self {
+ Self(<$type>::from_str_radix(value, 2).unwrap())
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Create a new instance of [`", core::stringify!($name), "`] ",
- "from a binary string."
- ),
- pub fn from_binary_string(value: String) -> Self {
- Self(<$type>::from_str_radix(value.as_str(), 2).unwrap())
+ "Create a new instance of [`", core::stringify!($name), "`] ",
+ "from a binary string."
+ ),
+ pub fn from_binary_string(value: String) -> Self {
+ Self(<$type>::from_str_radix(value.as_str(), 2).unwrap())
}
}
}
@@ -5050,31 +5045,31 @@
};
}
-/// Generates getters for state fields in `$name`
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_field_state {
- ($name:ident : $type:ty) => {
- $crate::__doc_comment! {
+/// Generates getters for state fields in `$name`
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_field_state {
+ ($name:ident : $type:ty) => {
+ $crate::__doc_comment! {
core::concat!(
- "Current state of this bitfield."
- ),
- impl $name {
- $crate::__doc_comment! {
+ "Current state of this bitfield."
+ ),
+ impl $name {
+ $crate::__doc_comment! {
core::concat!(
- "Returns the current field value as a [`", core::stringify!($type), "`]"
- ),
- pub fn as_integer(&self) -> $type {
- self.0
- }
+ "Returns the current field value as a [`", core::stringify!($type), "`]"
+ ),
+ pub fn as_integer(&self) -> $type {
+ self.0
+ }
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Returns the current field value as a binary formatted string."
- ),
- pub fn as_binary(&self) -> String {
- std::format!("{:0width$b}", self.0, width = Self::BITS)
+ "Returns the current field value as a binary formatted string."
+ ),
+ pub fn as_binary(&self) -> String {
+ std::format!("{:0width$b}", self.0, width = Self::BITS)
}
}
}
@@ -5082,49 +5077,49 @@
};
}
-/// Generates getters by index for bit fields in `$name`
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_field_index_accessors {
- ($name:ident) => {
- $crate::__doc_comment! {
+/// Generates getters by index for bit fields in `$name`
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_field_index_accessors {
+ ($name:ident) => {
+ $crate::__doc_comment! {
core::concat!(
- "Field accessors by index for [`", core::stringify!($name), "`]."
- ),
- impl $name {
- $crate::__doc_comment! {
+ "Field accessors by index for [`", core::stringify!($name), "`]."
+ ),
+ impl $name {
+ $crate::__doc_comment! {
core::concat!(
- "Returns the value of the bit at the supplied index as a boolean."
- ),
- pub fn get_index(&self, index: u8) -> bool {
- ((self.0 >> index) & 1) == 1
- }
+ "Returns the value of the bit at the supplied index as a boolean."
+ ),
+ pub fn get_index(&self, index: u8) -> bool {
+ ((self.0 >> index) & 1) == 1
+ }
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Sets the value of the bit at the supplied index to `1`."
- ),
- pub fn set_index(&mut self, index: u8) {
- self.0 |= (1 << index);
+ "Sets the value of the bit at the supplied index to `1`."
+ ),
+ pub fn set_index(&mut self, index: u8) {
+ self.0 |= (1 << index);
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Sets the value of the bit at the supplied index to `0`."
- ),
- pub fn clear_index(&mut self, index: u8) {
- self.0 &= !(1 << index);
+ "Sets the value of the bit at the supplied index to `0`."
+ ),
+ pub fn clear_index(&mut self, index: u8) {
+ self.0 &= !(1 << index);
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Flips the value of the bit at the supplied index."
- ),
- pub fn toggle_index(&mut self, index: u8) {
- self.0 ^= (1 << index);
+ "Flips the value of the bit at the supplied index."
+ ),
+ pub fn toggle_index(&mut self, index: u8) {
+ self.0 ^= (1 << index);
}
}
}
@@ -5132,99 +5127,99 @@
};
}
-/// Generates getters by flag for bit fields in `$name`
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_field_flag_accessors {
- ($name:ident $flag:ident $type:ty) => {
- $crate::__doc_comment! {
+/// Generates getters by flag for bit fields in `$name`
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_field_flag_accessors {
+ ($name:ident $flag:ident $type:ty) => {
+ $crate::__doc_comment! {
core::concat!(
- "Named field accessors by [`", core::stringify!($flag), "`] for [`", core::stringify!($name), "`]."
- ),
- impl $name {
- $crate::__doc_comment! {
+ "Named field accessors by [`", core::stringify!($flag), "`] for [`", core::stringify!($name), "`]."
+ ),
+ impl $name {
+ $crate::__doc_comment! {
core::concat!(
- "Returns the value of the bit at the supplied flag as a boolean."
- ),
- pub fn get(&self, flag: $flag) -> bool {
- ((self.0 >> (flag as $type)) & 1) == 1
- }
+ "Returns the value of the bit at the supplied flag as a boolean."
+ ),
+ pub fn get(&self, flag: $flag) -> bool {
+ ((self.0 >> (flag as $type)) & 1) == 1
+ }
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Sets the value of the bit at the supplied flag to `1`."
- ),
- pub fn set(&mut self, flag: $flag) -> &mut Self {
- self.0 |= (1 << (flag as $type));
- self
- }
+ "Sets the value of the bit at the supplied flag to `1`."
+ ),
+ pub fn set(&mut self, flag: $flag) -> &mut Self {
+ self.0 |= (1 << (flag as $type));
+ self
+ }
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Sets the value of the bit at the supplied flag to `0`."
- ),
- pub fn clear(&mut self, flag: $flag) -> &mut Self {
- self.0 &= !(1 << (flag as $type));
- self
- }
+ "Sets the value of the bit at the supplied flag to `0`."
+ ),
+ pub fn clear(&mut self, flag: $flag) -> &mut Self {
+ self.0 &= !(1 << (flag as $type));
+ self
+ }
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Flips the value of the bit at the supplied flag."
- ),
- pub fn toggle(&mut self, flag: $flag) -> &mut Self {
- self.0 ^= (1 << (flag as $type));
- self
- }
+ "Flips the value of the bit at the supplied flag."
+ ),
+ pub fn toggle(&mut self, flag: $flag) -> &mut Self {
+ self.0 ^= (1 << (flag as $type));
+ self
+ }
}
}
}
};
}
-/// Generates combinator methods for `$name`
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_field_flag_combinators {
- ($name:ident) => {
- $crate::__doc_comment! {
+/// Generates combinator methods for `$name`
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_field_flag_combinators {
+ ($name:ident) => {
+ $crate::__doc_comment! {
core::concat!(
- "Combinators for [`", core::stringify!($name), "`]."
- ),
- impl $name {
- $crate::__doc_comment! {
+ "Combinators for [`", core::stringify!($name), "`]."
+ ),
+ impl $name {
+ $crate::__doc_comment! {
core::concat!(
- "Returns a new [`", core::stringify!($name), "`]",
+ "Returns a new [`", core::stringify!($name), "`]",
"with ones for flags that do not match. ",
- "Does not consume `self`."
- ),
- pub fn diff(&self, other: Self) -> Self {
- Self(self.0 ^ other.0)
+ "Does not consume `self`."
+ ),
+ pub fn diff(&self, other: Self) -> Self {
+ Self(self.0 ^ other.0)
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Returns a new [`", core::stringify!($name), "`]",
+ "Returns a new [`", core::stringify!($name), "`]",
"with ones for flags that were set on either input. ",
- "Does not consume `self`."
- ),
- pub fn combine(&self, other: Self) -> Self {
- Self(self.0 | other.0)
+ "Does not consume `self`."
+ ),
+ pub fn combine(&self, other: Self) -> Self {
+ Self(self.0 | other.0)
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Returns a new [`", core::stringify!($name), "`]",
+ "Returns a new [`", core::stringify!($name), "`]",
"with ones for flags that were set on both inputs. ",
- "Does not consume `self`."
- ),
- pub fn intersect(&self, other: Self) -> Self {
- Self(self.0 & other.0)
+ "Does not consume `self`."
+ ),
+ pub fn intersect(&self, other: Self) -> Self {
+ Self(self.0 & other.0)
}
}
}
@@ -5232,46 +5227,46 @@
};
}
-/// Generates conversion methods for `$name`
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_field_flag_converters {
- ($name:ident) => {
- $crate::__doc_comment! {
+/// Generates conversion methods for `$name`
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_field_flag_converters {
+ ($name:ident) => {
+ $crate::__doc_comment! {
core::concat!(
- "Conversion methods."
- ),
- impl $name {
- $crate::__doc_comment! {
+ "Conversion methods."
+ ),
+ impl $name {
+ $crate::__doc_comment! {
core::concat!(
- "Returns a new [`", core::stringify!($name), "`]",
+ "Returns a new [`", core::stringify!($name), "`]",
"with ones for flags that do not match. ",
- "Consumes `self`."
- ),
- pub fn into_diff(self, other: Self) -> Self {
- Self(self.0 ^ other.0)
+ "Consumes `self`."
+ ),
+ pub fn into_diff(self, other: Self) -> Self {
+ Self(self.0 ^ other.0)
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Returns a new [`", core::stringify!($name), "`]",
+ "Returns a new [`", core::stringify!($name), "`]",
"with ones for flags that were set on either input. ",
- "Consumes `self`."
- ),
- pub fn into_combined(self, other: Self) -> Self {
- Self(self.0 | other.0)
+ "Consumes `self`."
+ ),
+ pub fn into_combined(self, other: Self) -> Self {
+ Self(self.0 | other.0)
}
}
- $crate::__doc_comment! {
+ $crate::__doc_comment! {
core::concat!(
- "Returns a new [`", core::stringify!($name), "`]",
+ "Returns a new [`", core::stringify!($name), "`]",
"with ones for flags that were set on both inputs. ",
- "Consumes `self`."
- ),
- pub fn into_intersection(self, other: Self) -> Self {
- Self(self.0 & other.0)
+ "Consumes `self`."
+ ),
+ pub fn into_intersection(self, other: Self) -> Self {
+ Self(self.0 & other.0)
}
}
}
@@ -5279,2402 +5274,2400 @@
};
}
-// -------------------------------------------------------------------------------------------------
-// Trait Implementations
-
-// Operators
-
-/// Generates a set of bitwise operators
-/// for a set of parameters
-#[doc(hidden)]
-#[macro_export(local_inner_macros)]
-macro_rules! __impl_bitwise_operators {
-
- // Owned
- (
- [$flag:ty] for $dest:ident : ($self:ident $other:ident -> $output:ident)
- $( BitAnd => $bitand:block )?
- $( BitOr => $bitor:block )?
- $( BitXor => $bitxor:block )?
- $( BitAndAssign => $bitand_assign:block )?
- $( BitOrAssign => $bitor_assign:block )?
- $( BitXorAssign => $bitxor_assign:block )?
- ) => {
- $( __impl_operator! {BitAnd [$flag] bitand for $dest ($self $other -> $output) => $bitand} )?
- $( __impl_operator! {BitOr [$flag] bitor for $dest ($self $other -> $output) => $bitor} )?
- $( __impl_operator! {BitXor [$flag] bitxor for $dest ($self $other -> $output) => $bitxor} )?
-
- $( __impl_assign_operator! {BitAndAssign [$flag] bitand_assign for $dest ($self $other) => $bitand_assign} )?
- $( __impl_assign_operator! {BitOrAssign [$flag] bitor_assign for $dest ($self $other) => $bitor_assign} )?
- $( __impl_assign_operator! {BitXorAssign [$flag] bitxor_assign for $dest ($self $other) => $bitxor_assign} )?
- };
-
- // Reference
- (
- [$flag:ty] for & $dest:ident : ($self:ident $other:ident -> $output:ident)
- $( BitAnd => $bitand:block )?
- $( BitOr => $bitor:block )?
- $( BitXor => $bitxor:block )?
- ) => {
- $( __impl_operator! {BitAnd [$flag] bitand for & $dest ($self $other -> $output) => $bitand} )?
- $( __impl_operator! {BitOr [$flag] bitor for & $dest ($self $other -> $output) => $bitor} )?
- $( __impl_operator! {BitXor [$flag] bitxor for & $dest ($self $other -> $output) => $bitxor} )?
- };
-
- // Mutable Reference
- (
- [$flag:ty] for &mut $dest:ident : ($self:ident $other:ident -> $output:ident)
- $( BitAnd => $bitand:block )?
- $( BitOr => $bitor:block )?
- $( BitXor => $bitxor:block )?
- ) => {
- $( __impl_operator! {BitAnd [$flag] bitand for &mut $dest ($self $other -> $output) => $bitand} )?
- $( __impl_operator! {BitOr [$flag] bitor for &mut $dest ($self $other -> $output) => $bitor} )?
- $( __impl_operator! {BitXor [$flag] bitxor for &mut $dest ($self $other -> $output) => $bitxor} )?
- };
+// -------------------------------------------------------------------------------------------------
+// Trait Implementations
+
+// Operators
+
+/// Generates a set of bitwise operators
+/// for a set of parameters
+#[doc(hidden)]
+#[macro_export(local_inner_macros)]
+macro_rules! __impl_bitwise_operators {
+
+ // Owned
+ (
+ [$flag:ty] for $dest:ident : ($self:ident $other:ident -> $output:ident)
+ $( BitAnd => $bitand:block )?
+ $( BitOr => $bitor:block )?
+ $( BitXor => $bitxor:block )?
+ $( BitAndAssign => $bitand_assign:block )?
+ $( BitOrAssign => $bitor_assign:block )?
+ $( BitXorAssign => $bitxor_assign:block )?
+ ) => {
+ $( __impl_operator! {BitAnd [$flag] bitand for $dest ($self $other -> $output) => $bitand} )?
+ $( __impl_operator! {BitOr [$flag] bitor for $dest ($self $other -> $output) => $bitor} )?
+ $( __impl_operator! {BitXor [$flag] bitxor for $dest ($self $other -> $output) => $bitxor} )?
+
+ $( __impl_assign_operator! {BitAndAssign [$flag] bitand_assign for $dest ($self $other) => $bitand_assign} )?
+ $( __impl_assign_operator! {BitOrAssign [$flag] bitor_assign for $dest ($self $other) => $bitor_assign} )?
+ $( __impl_assign_operator! {BitXorAssign [$flag] bitxor_assign for $dest ($self $other) => $bitxor_assign} )?
+ };
+
+ // Reference
+ (
+ [$flag:ty] for & $dest:ident : ($self:ident $other:ident -> $output:ident)
+ $( BitAnd => $bitand:block )?
+ $( BitOr => $bitor:block )?
+ $( BitXor => $bitxor:block )?
+ ) => {
+ $( __impl_operator! {BitAnd [$flag] bitand for & $dest ($self $other -> $output) => $bitand} )?
+ $( __impl_operator! {BitOr [$flag] bitor for & $dest ($self $other -> $output) => $bitor} )?
+ $( __impl_operator! {BitXor [$flag] bitxor for & $dest ($self $other -> $output) => $bitxor} )?
+ };
+
+ // Mutable Reference
+ (
+ [$flag:ty] for &mut $dest:ident : ($self:ident $other:ident -> $output:ident)
+ $( BitAnd => $bitand:block )?
+ $( BitOr => $bitor:block )?
+ $( BitXor => $bitxor:block )?
+ ) => {
+ $( __impl_operator! {BitAnd [$flag] bitand for &mut $dest ($self $other -> $output) => $bitand} )?
+ $( __impl_operator! {BitOr [$flag] bitor for &mut $dest ($self $other -> $output) => $bitor} )?
+ $( __impl_operator! {BitXor [$flag] bitxor for &mut $dest ($self $other -> $output) => $bitxor} )?
+ };
}
-/// Generates a generic operator
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_operator {
-
- // Owned
- ( $op_type:ident [$rhs:ty] $op_lower:ident for $dest:ident ($self:ident $other:ident -> $output:ident) => $block:block ) => {
- impl std::ops::$op_type<$rhs> for $dest {
- type Output = $output;
- fn $op_lower($self, $other: $rhs) -> Self::Output $block
- }
+/// Generates a generic operator
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_operator {
+
+ // Owned
+ ( $op_type:ident [$rhs:ty] $op_lower:ident for $dest:ident ($self:ident $other:ident -> $output:ident) => $block:block ) => {
+ impl std::ops::$op_type<$rhs> for $dest {
+ type Output = $output;
+ fn $op_lower($self, $other: $rhs) -> Self::Output $block
+ }
};
- // Reference
- ( $op_type:ident [$rhs:ty] $op_lower:ident for & $dest:ident ($self:ident $other:ident -> $output:ident) => $block:block ) => {
- impl std::ops::$op_type<$rhs> for &$dest {
- type Output = $output;
- fn $op_lower($self, $other: $rhs) -> Self::Output $block
- }
+ // Reference
+ ( $op_type:ident [$rhs:ty] $op_lower:ident for & $dest:ident ($self:ident $other:ident -> $output:ident) => $block:block ) => {
+ impl std::ops::$op_type<$rhs> for &$dest {
+ type Output = $output;
+ fn $op_lower($self, $other: $rhs) -> Self::Output $block
+ }
};
- // Mutable Reference
- ( $op_type:ident [$rhs:ty] $op_lower:ident for &mut $dest:ident ($self:ident $other:ident -> $output:ident) => $block:block ) => {
- impl std::ops::$op_type<$rhs> for &mut $dest {
- type Output = $output;
- fn $op_lower($self, $other: $rhs) -> Self::Output $block
- }
+ // Mutable Reference
+ ( $op_type:ident [$rhs:ty] $op_lower:ident for &mut $dest:ident ($self:ident $other:ident -> $output:ident) => $block:block ) => {
+ impl std::ops::$op_type<$rhs> for &mut $dest {
+ type Output = $output;
+ fn $op_lower($self, $other: $rhs) -> Self::Output $block
+ }
};
}
-/// Generates a generic assign operator
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_assign_operator {
- ( $op_type:ident [$rhs:ty] $op_lower:ident for $dest:ident ($self:ident $other:ident) => $block:block ) => {
- impl std::ops::$op_type<$rhs> for $dest {
- fn $op_lower(&mut $self, $other: $rhs) $block
- }
+/// Generates a generic assign operator
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_assign_operator {
+ ( $op_type:ident [$rhs:ty] $op_lower:ident for $dest:ident ($self:ident $other:ident) => $block:block ) => {
+ impl std::ops::$op_type<$rhs> for $dest {
+ fn $op_lower(&mut $self, $other: $rhs) $block
+ }
};
}
-// Defaults
+// Defaults
-/// Generates a [`Default`] implementation.
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_default {
- ($name:ident => $block:block) => {
- impl Default for $name {
- fn default() -> Self $block
- }
+/// Generates a [`Default`] implementation.
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_default {
+ ($name:ident => $block:block) => {
+ impl Default for $name {
+ fn default() -> Self $block
+ }
};
}
-// Converters
-
-/// Generates a [`From`] implementation.
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_from {
- ($(#[$doc:meta])* $from:ty as $to:ident ($arg:ident) => $block:block) => {
- $(#[$doc])*
- impl From<$from> for $to {
- fn from($arg: $from) -> $to $block
- }
+// Converters
+
+/// Generates a [`From`] implementation.
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_from {
+ ($(#[$doc:meta])* $from:ty as $to:ident ($arg:ident) => $block:block) => {
+ $(#[$doc])*
+ impl From<$from> for $to {
+ fn from($arg: $from) -> $to $block
+ }
};
}
-// Formatters
+// Formatters
-/// Generates formatter implementations
-/// from a set of parameters.
-#[doc(hidden)]
-#[macro_export(local_inner_macros)]
-macro_rules! __impl_formatters {
- ($name:ident ($self:ident $f:ident) { $( $formatter:ident => $block:block )+ } ) => {
- $( __impl_formatter!($formatter for $name ($self $f) => $block); )+
+/// Generates formatter implementations
+/// from a set of parameters.
+#[doc(hidden)]
+#[macro_export(local_inner_macros)]
+macro_rules! __impl_formatters {
+ ($name:ident ($self:ident $f:ident) { $( $formatter:ident => $block:block )+ } ) => {
+ $( __impl_formatter!($formatter for $name ($self $f) => $block); )+
};
}
-/// Generates a generic formatter implementation.
-#[doc(hidden)]
-#[macro_export]
-macro_rules! __impl_formatter {
- ($formatter:ident for $name:ident ($self:ident $f:ident) => $block:block) => {
- impl std::fmt::$formatter for $name {
- fn fmt(&$self, $f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result $block
- }
+/// Generates a generic formatter implementation.
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __impl_formatter {
+ ($formatter:ident for $name:ident ($self:ident $f:ident) => $block:block) => {
+ impl std::fmt::$formatter for $name {
+ fn fmt(&$self, $f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result $block
+ }
};
}
-// -------------------------------------------------------------------------------------------------
-// Example
-
-#[allow(dead_code)]
-#[allow(unused_variables)]
-#[cfg(doc)]
-pub mod examples {
- //! Examples of generated output using different configurations.
- //!
- //! __This module is only compiled with documentation builds
- //! and will not be available for import.__
- //!
- //! use the [`bitfield`] macro to generate a field struct and flag enum.
- //!
-
- #[allow(dead_code)]
- #[allow(unused_variables)]
- #[cfg(doc)]
- pub mod full_example {
- //! Example of generated output, using both a bit field and a flag enum.
- //!
- //! __This module is only compiled with documentation builds
- //! and will not be available for import.__
- //!
- //! use the [`bitfield`] macro to generate a field struct and flag enum.
- //!
- use super::*;
-
- bitfield! {
- /// Optional docstring for my example bit field.
- pub u8 ExampleField
- /// Optional docstring for my flag enum.
- ExampleFlags {
- /// Optional docstring for Flag0
- 0 : Flag0,
- /// Optional docstring for Flag1
- 1 : Flag1,
- /// Optional docstring for Flag2
- 2 : Flag2,
- /// Optional docstring for Flag3
- 3 : Flag3,
- /// Optional docstring for Flag4
- 4 : Flag4,
- /// Optional docstring for Flag5
- 5 : Flag5,
- /// Optional docstring for Flag6
- 6 : Flag6,
- /// Optional docstring for Flag7
- 7 : Flag7,
+// -------------------------------------------------------------------------------------------------
+// Example
+
+#[allow(dead_code)]
+#[allow(unused_variables)]
+#[cfg(doc)]
+pub mod examples {
+ //! Examples of generated output using different configurations.
+ //!
+ //! __This module is only compiled with documentation builds
+ //! and will not be available for import.__
+ //!
+ //! use the [`bitfield`] macro to generate a field struct and flag enum.
+ //!
+
+ #[allow(dead_code)]
+ #[allow(unused_variables)]
+ #[cfg(doc)]
+ pub mod full_example {
+ //! Example of generated output, using both a bit field and a flag enum.
+ //!
+ //! __This module is only compiled with documentation builds
+ //! and will not be available for import.__
+ //!
+ //! use the [`bitfield`] macro to generate a field struct and flag enum.
+ //!
+ use super::*;
+
+ bitfield! {
+ /// Optional docstring for my example bit field.
+ pub u8 ExampleField
+ /// Optional docstring for my flag enum.
+ ExampleFlags {
+ /// Optional docstring for Flag0
+ 0 : Flag0,
+ /// Optional docstring for Flag1
+ 1 : Flag1,
+ /// Optional docstring for Flag2
+ 2 : Flag2,
+ /// Optional docstring for Flag3
+ 3 : Flag3,
+ /// Optional docstring for Flag4
+ 4 : Flag4,
+ /// Optional docstring for Flag5
+ 5 : Flag5,
+ /// Optional docstring for Flag6
+ 6 : Flag6,
+ /// Optional docstring for Flag7
+ 7 : Flag7,
}
}
}
- #[allow(dead_code)]
- #[allow(unused_variables)]
- #[cfg(doc)]
- pub mod flagless_example {
- //! Example of generated output, using only a bit field without a flag enum.
- //!
- //! __This module is only compiled with documentation builds
- //! and will not be available for import.__
- //!
- //! use the [`bitfield`] macro to generate a field struct and flag enum.
- //!
- use super::*;
-
- bitfield! {
- /// Optional docstring for my example bit field.
- pub u8 ExampleField
+ #[allow(dead_code)]
+ #[allow(unused_variables)]
+ #[cfg(doc)]
+ pub mod flagless_example {
+ //! Example of generated output, using only a bit field without a flag enum.
+ //!
+ //! __This module is only compiled with documentation builds
+ //! and will not be available for import.__
+ //!
+ //! use the [`bitfield`] macro to generate a field struct and flag enum.
+ //!
+ use super::*;
+
+ bitfield! {
+ /// Optional docstring for my example bit field.
+ pub u8 ExampleField
}
}
}
-// -------------------------------------------------------------------------------------------------
-// Tests
+// -------------------------------------------------------------------------------------------------
+// Tests
-#[allow(dead_code)]
-#[allow(unused_variables)]
-#[cfg(test)]
-mod test {
- use super::*;
- use std::{u128, u16, u32, u64, usize};
+#[allow(dead_code)]
+#[allow(unused_variables)]
+#[cfg(test)]
+mod test {
+ use super::*;
+ use std::{u128, u16, u32, u64, usize};
- macro_rules! tests {
- ( $( $name:ident => $block:block )+ ) => {
+ macro_rules! tests {
+ ( $( $name:ident => $block:block )+ ) => {
$(
- #[test]
- fn $name() $block
- )+
+ #[test]
+ fn $name() $block
+ )+
};
}
- bitfield! {
- /// My Test Thing
- u8 MyFieldU8
- MyFlagsU8 {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ bitfield! {
+ /// My Test Thing
+ u8 MyFieldU8
+ MyFlagsU8 {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
}
}
- bitfield! {
- /// My Test Thing
- u16 MyFieldU16
- MyFlagsU16 {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ bitfield! {
+ /// My Test Thing
+ u16 MyFieldU16
+ MyFlagsU16 {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
}
}
- bitfield! {
- /// My Test Thing
- u32 MyFieldU32
- MyFlagsU32 {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ bitfield! {
+ /// My Test Thing
+ u32 MyFieldU32
+ MyFlagsU32 {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
}
}
- bitfield! {
- /// My Test Thing
- u64 MyFieldU64
- MyFlagsU64 {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
- 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
- 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
- 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
- 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
+ bitfield! {
+ /// My Test Thing
+ u64 MyFieldU64
+ MyFlagsU64 {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
+ 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
+ 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
+ 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
}
}
- bitfield! {
- /// My Test Thing
- u128 MyFieldU128
- MyFlagsU128 {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
- 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
- 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
- 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
- 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
- 64 : Flag64, 65 : Flag65, 66 : Flag66, 67 : Flag67, 68 : Flag68, 69 : Flag69, 70 : Flag70, 71 : Flag71,
- 72 : Flag72, 73 : Flag73, 74 : Flag74, 75 : Flag75, 76 : Flag76, 77 : Flag77, 78 : Flag78, 79 : Flag79,
- 80 : Flag80, 81 : Flag81, 82 : Flag82, 83 : Flag83, 84 : Flag84, 85 : Flag85, 86 : Flag86, 87 : Flag87,
- 88 : Flag88, 89 : Flag89, 90 : Flag90, 91 : Flag91, 92 : Flag92, 93 : Flag93, 94 : Flag94, 95 : Flag95,
- 96 : Flag96, 97 : Flag97, 98 : Flag98, 99 : Flag99, 100 : Flag100, 101 : Flag101, 102 : Flag102, 103 : Flag103,
- 104 : Flag104, 105 : Flag105, 106 : Flag106, 107 : Flag107, 108 : Flag108, 109 : Flag109, 110 : Flag110, 111 : Flag111,
- 112 : Flag112, 113 : Flag113, 114 : Flag114, 115 : Flag115, 116 : Flag116, 117 : Flag117, 118 : Flag118, 119 : Flag119,
- 120 : Flag120, 121 : Flag121, 122 : Flag122, 123 : Flag123, 124 : Flag124, 125 : Flag125, 126 : Flag126, 127 : Flag127,
+ bitfield! {
+ /// My Test Thing
+ u128 MyFieldU128
+ MyFlagsU128 {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
+ 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
+ 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
+ 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
+ 64 : Flag64, 65 : Flag65, 66 : Flag66, 67 : Flag67, 68 : Flag68, 69 : Flag69, 70 : Flag70, 71 : Flag71,
+ 72 : Flag72, 73 : Flag73, 74 : Flag74, 75 : Flag75, 76 : Flag76, 77 : Flag77, 78 : Flag78, 79 : Flag79,
+ 80 : Flag80, 81 : Flag81, 82 : Flag82, 83 : Flag83, 84 : Flag84, 85 : Flag85, 86 : Flag86, 87 : Flag87,
+ 88 : Flag88, 89 : Flag89, 90 : Flag90, 91 : Flag91, 92 : Flag92, 93 : Flag93, 94 : Flag94, 95 : Flag95,
+ 96 : Flag96, 97 : Flag97, 98 : Flag98, 99 : Flag99, 100 : Flag100, 101 : Flag101, 102 : Flag102, 103 : Flag103,
+ 104 : Flag104, 105 : Flag105, 106 : Flag106, 107 : Flag107, 108 : Flag108, 109 : Flag109, 110 : Flag110, 111 : Flag111,
+ 112 : Flag112, 113 : Flag113, 114 : Flag114, 115 : Flag115, 116 : Flag116, 117 : Flag117, 118 : Flag118, 119 : Flag119,
+ 120 : Flag120, 121 : Flag121, 122 : Flag122, 123 : Flag123, 124 : Flag124, 125 : Flag125, 126 : Flag126, 127 : Flag127,
}
}
- #[cfg(target_pointer_width = "64")]
- bitfield! {
- /// My Test Thing
- usize MyFieldUsize
- MyFlagsUsize {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
- 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
- 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
- 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
- 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
+ #[cfg(target_pointer_width = "64")]
+ bitfield! {
+ /// My Test Thing
+ usize MyFieldUsize
+ MyFlagsUsize {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
+ 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
+ 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
+ 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
}
}
- #[cfg(target_pointer_width = "32")]
- bitfield! {
- /// My Test Thing
- usize MyFieldUsize
- MyFlagsUsize {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ #[cfg(target_pointer_width = "32")]
+ bitfield! {
+ /// My Test Thing
+ usize MyFieldUsize
+ MyFlagsUsize {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
}
}
- bitfield! {
- /// My Test Thing
- u8 MyFieldU8Nf
- MyFlagsU8Nf {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ bitfield! {
+ /// My Test Thing
+ u8 MyFieldU8Nf
+ MyFlagsU8Nf {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
}
}
- bitfield! {
- /// My Test Thing
- u16 MyFieldU16Nf
- MyFlagsU16Nf {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ bitfield! {
+ /// My Test Thing
+ u16 MyFieldU16Nf
+ MyFlagsU16Nf {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
}
}
- bitfield! {
- /// My Test Thing
- u32 MyFieldU32Nf
- MyFlagsU32Nf {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ bitfield! {
+ /// My Test Thing
+ u32 MyFieldU32Nf
+ MyFlagsU32Nf {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
}
}
- bitfield! {
- /// My Test Thing
- u64 MyFieldU64Nf
- MyFlagsU64Nf {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
- 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
- 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
- 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
- 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
+ bitfield! {
+ /// My Test Thing
+ u64 MyFieldU64Nf
+ MyFlagsU64Nf {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
+ 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
+ 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
+ 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
}
}
- bitfield! {
- /// My Test Thing
- u128 MyFieldU128Nf
- MyFlagsU128Nf {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
- 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
- 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
- 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
- 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
- 64 : Flag64, 65 : Flag65, 66 : Flag66, 67 : Flag67, 68 : Flag68, 69 : Flag69, 70 : Flag70, 71 : Flag71,
- 72 : Flag72, 73 : Flag73, 74 : Flag74, 75 : Flag75, 76 : Flag76, 77 : Flag77, 78 : Flag78, 79 : Flag79,
- 80 : Flag80, 81 : Flag81, 82 : Flag82, 83 : Flag83, 84 : Flag84, 85 : Flag85, 86 : Flag86, 87 : Flag87,
- 88 : Flag88, 89 : Flag89, 90 : Flag90, 91 : Flag91, 92 : Flag92, 93 : Flag93, 94 : Flag94, 95 : Flag95,
- 96 : Flag96, 97 : Flag97, 98 : Flag98, 99 : Flag99, 100 : Flag100, 101 : Flag101, 102 : Flag102, 103 : Flag103,
- 104 : Flag104, 105 : Flag105, 106 : Flag106, 107 : Flag107, 108 : Flag108, 109 : Flag109, 110 : Flag110, 111 : Flag111,
- 112 : Flag112, 113 : Flag113, 114 : Flag114, 115 : Flag115, 116 : Flag116, 117 : Flag117, 118 : Flag118, 119 : Flag119,
- 120 : Flag120, 121 : Flag121, 122 : Flag122, 123 : Flag123, 124 : Flag124, 125 : Flag125, 126 : Flag126, 127 : Flag127,
+ bitfield! {
+ /// My Test Thing
+ u128 MyFieldU128Nf
+ MyFlagsU128Nf {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
+ 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
+ 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
+ 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
+ 64 : Flag64, 65 : Flag65, 66 : Flag66, 67 : Flag67, 68 : Flag68, 69 : Flag69, 70 : Flag70, 71 : Flag71,
+ 72 : Flag72, 73 : Flag73, 74 : Flag74, 75 : Flag75, 76 : Flag76, 77 : Flag77, 78 : Flag78, 79 : Flag79,
+ 80 : Flag80, 81 : Flag81, 82 : Flag82, 83 : Flag83, 84 : Flag84, 85 : Flag85, 86 : Flag86, 87 : Flag87,
+ 88 : Flag88, 89 : Flag89, 90 : Flag90, 91 : Flag91, 92 : Flag92, 93 : Flag93, 94 : Flag94, 95 : Flag95,
+ 96 : Flag96, 97 : Flag97, 98 : Flag98, 99 : Flag99, 100 : Flag100, 101 : Flag101, 102 : Flag102, 103 : Flag103,
+ 104 : Flag104, 105 : Flag105, 106 : Flag106, 107 : Flag107, 108 : Flag108, 109 : Flag109, 110 : Flag110, 111 : Flag111,
+ 112 : Flag112, 113 : Flag113, 114 : Flag114, 115 : Flag115, 116 : Flag116, 117 : Flag117, 118 : Flag118, 119 : Flag119,
+ 120 : Flag120, 121 : Flag121, 122 : Flag122, 123 : Flag123, 124 : Flag124, 125 : Flag125, 126 : Flag126, 127 : Flag127,
}
}
- #[cfg(target_pointer_width = "64")]
- bitfield! {
- /// My Test Thing
- usize MyFieldUsizeNf
- MyFlagsUsizeNf {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
- 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
- 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
- 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
- 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
+ #[cfg(target_pointer_width = "64")]
+ bitfield! {
+ /// My Test Thing
+ usize MyFieldUsizeNf
+ MyFlagsUsizeNf {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ 32 : Flag32, 33 : Flag33, 34 : Flag34, 35 : Flag35, 36 : Flag36, 37 : Flag37, 38 : Flag38, 39 : Flag39,
+ 40 : Flag40, 41 : Flag41, 42 : Flag42, 43 : Flag43, 44 : Flag44, 45 : Flag45, 46 : Flag46, 47 : Flag47,
+ 48 : Flag48, 49 : Flag49, 50 : Flag50, 51 : Flag51, 52 : Flag52, 53 : Flag53, 54 : Flag54, 55 : Flag55,
+ 56 : Flag56, 57 : Flag57, 58 : Flag58, 59 : Flag59, 60 : Flag60, 61 : Flag61, 62 : Flag62, 63 : Flag63,
}
}
- #[cfg(target_pointer_width = "32")]
- bitfield! {
- /// My Test Thing
- usize MyFieldUsizeNf
- MyFlagsUsizeNf {
- 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
- 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
- 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
- 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
+ #[cfg(target_pointer_width = "32")]
+ bitfield! {
+ /// My Test Thing
+ usize MyFieldUsizeNf
+ MyFlagsUsizeNf {
+ 0 : Flag0, 1 : Flag1, 2 : Flag2, 3 : Flag3, 4 : Flag4, 5 : Flag5, 6 : Flag6, 7 : Flag7,
+ 8 : Flag8, 9 : Flag9, 10 : Flag10, 11 : Flag11, 12 : Flag12, 13 : Flag13, 14 : Flag14, 15 : Flag15,
+ 16 : Flag16, 17 : Flag17, 18 : Flag18, 19 : Flag19, 20 : Flag20, 21 : Flag21, 22 : Flag22, 23 : Flag23,
+ 24 : Flag24, 25 : Flag25, 26 : Flag26, 27 : Flag27, 28 : Flag28, 29 : Flag29, 30 : Flag30, 31 : Flag31,
}
}
- const U8: u8 = 123;
- const B8: &str = "01111011";
- const U16: u16 = 51526;
- const B16: &str = "1100100101000110";
- const U32: u32 = 2828091834;
- const B32: &str = "10101000100100010100000110111010";
- const U64: u64 = 18325744043706550615;
- const B64: &str = "1111111001010010000111110001110100100001110111000000100101010111";
- const U128: u128 = 160140183460469230739687303714882104727;
- const B128: &str = "01111000011110011110000010100001011000111110000100101011010111011111111110000110011101100010110100100000110001101010110110010111";
+ const U8: u8 = 123;
+ const B8: &str = "01111011";
+ const U16: u16 = 51526;
+ const B16: &str = "1100100101000110";
+ const U32: u32 = 2828091834;
+ const B32: &str = "10101000100100010100000110111010";
+ const U64: u64 = 18325744043706550615;
+ const B64: &str = "1111111001010010000111110001110100100001110111000000100101010111";
+ const U128: u128 = 160140183460469230739687303714882104727;
+ const B128: &str = "01111000011110011110000010100001011000111110000100101011010111011111111110000110011101100010110100100000110001101010110110010111";
- #[cfg(target_pointer_width = "64")]
- const USIZE: usize = 18325744043706550615;
- #[cfg(target_pointer_width = "64")]
- const BSIZE: &str = "1111111001010010000111110001110100100001110111000000100101010111";
+ #[cfg(target_pointer_width = "64")]
+ const USIZE: usize = 18325744043706550615;
+ #[cfg(target_pointer_width = "64")]
+ const BSIZE: &str = "1111111001010010000111110001110100100001110111000000100101010111";
- #[cfg(target_pointer_width = "32")]
- const USIZE: usize = 2828091834;
- #[cfg(target_pointer_width = "32")]
- const BSIZE: &str = "10101000100100010100000110111010";
+ #[cfg(target_pointer_width = "32")]
+ const USIZE: usize = 2828091834;
+ #[cfg(target_pointer_width = "32")]
+ const BSIZE: &str = "10101000100100010100000110111010";
- // constructors
- tests! {
- new_u8 => {
- MyFieldU8(U8);
+ // constructors
+ tests! {
+ new_u8 => {
+ MyFieldU8(U8);
}
- new_u16 => {
- MyFieldU16(U16);
+ new_u16 => {
+ MyFieldU16(U16);
}
- new_u32 => {
- MyFieldU32(U32);
+ new_u32 => {
+ MyFieldU32(U32);
}
- new_u64 => {
- MyFieldU64(U64);
+ new_u64 => {
+ MyFieldU64(U64);
}
- new_u128 => {
- MyFieldU128(U128);
+ new_u128 => {
+ MyFieldU128(U128);
}
- new_usize => {
- MyFieldUsize(USIZE);
+ new_usize => {
+ MyFieldUsize(USIZE);
}
}
- // from binary str
- tests! {
- from_binary_str_u8 => {
- assert_eq!(MyFieldU8::from_binary_str(B8), MyFieldU8(U8));
+ // from binary str
+ tests! {
+ from_binary_str_u8 => {
+ assert_eq!(MyFieldU8::from_binary_str(B8), MyFieldU8(U8));
}
- from_binary_str_u16 => {
- assert_eq!(MyFieldU16::from_binary_str(B16), MyFieldU16(U16));
+ from_binary_str_u16 => {
+ assert_eq!(MyFieldU16::from_binary_str(B16), MyFieldU16(U16));
}
- from_binary_str_u32 => {
- assert_eq!(MyFieldU32::from_binary_str(B32), MyFieldU32(U32));
+ from_binary_str_u32 => {
+ assert_eq!(MyFieldU32::from_binary_str(B32), MyFieldU32(U32));
}
- from_binary_str_u64 => {
- assert_eq!(MyFieldU64::from_binary_str(B64), MyFieldU64(U64));
+ from_binary_str_u64 => {
+ assert_eq!(MyFieldU64::from_binary_str(B64), MyFieldU64(U64));
}
- from_binary_str_u128 => {
- assert_eq!(MyFieldU128::from_binary_str(B128), MyFieldU128(U128));
+ from_binary_str_u128 => {
+ assert_eq!(MyFieldU128::from_binary_str(B128), MyFieldU128(U128));
}
- from_binary_str_usize => {
- assert_eq!(MyFieldUsize::from_binary_str(BSIZE), MyFieldUsize(USIZE));
+ from_binary_str_usize => {
+ assert_eq!(MyFieldUsize::from_binary_str(BSIZE), MyFieldUsize(USIZE));
}
}
- // from binary string
- tests! {
- from_binary_string_u8 => {
- assert_eq!(MyFieldU8::from_binary_string(String::from(B8)), MyFieldU8(U8));
+ // from binary string
+ tests! {
+ from_binary_string_u8 => {
+ assert_eq!(MyFieldU8::from_binary_string(String::from(B8)), MyFieldU8(U8));
}
- from_binary_string_u16 => {
- assert_eq!(MyFieldU16::from_binary_string(String::from(B16)), MyFieldU16(U16));
+ from_binary_string_u16 => {
+ assert_eq!(MyFieldU16::from_binary_string(String::from(B16)), MyFieldU16(U16));
}
- from_binary_string_u32 => {
- assert_eq!(MyFieldU32::from_binary_string(String::from(B32)), MyFieldU32(U32));
+ from_binary_string_u32 => {
+ assert_eq!(MyFieldU32::from_binary_string(String::from(B32)), MyFieldU32(U32));
}
- from_binary_string_u64 => {
- assert_eq!(MyFieldU64::from_binary_string(String::from(B64)), MyFieldU64(U64));
+ from_binary_string_u64 => {
+ assert_eq!(MyFieldU64::from_binary_string(String::from(B64)), MyFieldU64(U64));
}
- from_binary_string_u128 => {
- assert_eq!(MyFieldU128::from_binary_string(String::from(B128)), MyFieldU128(U128));
+ from_binary_string_u128 => {
+ assert_eq!(MyFieldU128::from_binary_string(String::from(B128)), MyFieldU128(U128));
}
- from_binary_string_usize => {
- assert_eq!(MyFieldUsize::from_binary_string(String::from(BSIZE)), MyFieldUsize(USIZE));
+ from_binary_string_usize => {
+ assert_eq!(MyFieldUsize::from_binary_string(String::from(BSIZE)), MyFieldUsize(USIZE));
}
}
- // ones
- tests! {
- ones_u8 => {
- assert_eq!(MyFieldU8::ones(), MyFieldU8(u8::MAX));
+ // ones
+ tests! {
+ ones_u8 => {
+ assert_eq!(MyFieldU8::ones(), MyFieldU8(u8::MAX));
}
- ones_u16 => {
- assert_eq!(MyFieldU16::ones(), MyFieldU16(u16::MAX));
+ ones_u16 => {
+ assert_eq!(MyFieldU16::ones(), MyFieldU16(u16::MAX));
}
- ones_u32 => {
- assert_eq!(MyFieldU32::ones(), MyFieldU32(u32::MAX));
+ ones_u32 => {
+ assert_eq!(MyFieldU32::ones(), MyFieldU32(u32::MAX));
}
- ones_u64 => {
- assert_eq!(MyFieldU64::ones(), MyFieldU64(u64::MAX));
+ ones_u64 => {
+ assert_eq!(MyFieldU64::ones(), MyFieldU64(u64::MAX));
}
- ones_u128 => {
- assert_eq!(MyFieldU128::ones(), MyFieldU128(u128::MAX));
+ ones_u128 => {
+ assert_eq!(MyFieldU128::ones(), MyFieldU128(u128::MAX));
}
- ones_usize => {
- assert_eq!(MyFieldUsize::ones(), MyFieldUsize(usize::MAX));
+ ones_usize => {
+ assert_eq!(MyFieldUsize::ones(), MyFieldUsize(usize::MAX));
}
}
- // zeros
- tests! {
- zeros_u8 => {
- assert_eq!(MyFieldU8::zeros(), MyFieldU8(0));
+ // zeros
+ tests! {
+ zeros_u8 => {
+ assert_eq!(MyFieldU8::zeros(), MyFieldU8(0));
}
- zeros_u16 => {
- assert_eq!(MyFieldU16::zeros(), MyFieldU16(0));
+ zeros_u16 => {
+ assert_eq!(MyFieldU16::zeros(), MyFieldU16(0));
}
- zeros_u32 => {
- assert_eq!(MyFieldU32::zeros(), MyFieldU32(0));
+ zeros_u32 => {
+ assert_eq!(MyFieldU32::zeros(), MyFieldU32(0));
}
- zeros_u64 => {
- assert_eq!(MyFieldU64::zeros(), MyFieldU64(0));
+ zeros_u64 => {
+ assert_eq!(MyFieldU64::zeros(), MyFieldU64(0));
}
- zeros_u128 => {
- assert_eq!(MyFieldU128::zeros(), MyFieldU128(0));
+ zeros_u128 => {
+ assert_eq!(MyFieldU128::zeros(), MyFieldU128(0));
}
- zeros_usize => {
- assert_eq!(MyFieldUsize::zeros(), MyFieldUsize(0));
+ zeros_usize => {
+ assert_eq!(MyFieldUsize::zeros(), MyFieldUsize(0));
}
}
- // defaults
- tests! {
- default_u8 => {
- assert_eq!(0, MyFieldU8::default().as_integer())
+ // defaults
+ tests! {
+ default_u8 => {
+ assert_eq!(0, MyFieldU8::default().as_integer())
}
- default_u16 => {
- assert_eq!(0, MyFieldU16::default().as_integer())
+ default_u16 => {
+ assert_eq!(0, MyFieldU16::default().as_integer())
}
- default_u32 => {
- assert_eq!(0, MyFieldU32::default().as_integer())
+ default_u32 => {
+ assert_eq!(0, MyFieldU32::default().as_integer())
}
- default_u64 => {
- assert_eq!(0, MyFieldU64::default().as_integer())
+ default_u64 => {
+ assert_eq!(0, MyFieldU64::default().as_integer())
}
- default_u128 => {
- assert_eq!(0, MyFieldU128::default().as_integer())
+ default_u128 => {
+ assert_eq!(0, MyFieldU128::default().as_integer())
}
- default_usize => {
- assert_eq!(0, MyFieldUsize::default().as_integer())
+ default_usize => {
+ assert_eq!(0, MyFieldUsize::default().as_integer())
}
}
- // bit count
- tests! {
- bit_count_u8 => {
- let field = MyFieldU8(U8);
- assert_eq!(u8::BITS as usize, MyFieldU8::BITS)
+ // bit count
+ tests! {
+ bit_count_u8 => {
+ let field = MyFieldU8(U8);
+ assert_eq!(u8::BITS as usize, MyFieldU8::BITS)
}
- bit_count_u16 => {
- let field = MyFieldU16(U16);
- assert_eq!(u16::BITS as usize, MyFieldU16::BITS)
+ bit_count_u16 => {
+ let field = MyFieldU16(U16);
+ assert_eq!(u16::BITS as usize, MyFieldU16::BITS)
}
- bit_count_u32 => {
- let field = MyFieldU32(U32);
- assert_eq!(u32::BITS as usize, MyFieldU32::BITS)
+ bit_count_u32 => {
+ let field = MyFieldU32(U32);
+ assert_eq!(u32::BITS as usize, MyFieldU32::BITS)
}
- bit_count_u64 => {
- let field = MyFieldU64(U64);
- assert_eq!(u64::BITS as usize, MyFieldU64::BITS)
+ bit_count_u64 => {
+ let field = MyFieldU64(U64);
+ assert_eq!(u64::BITS as usize, MyFieldU64::BITS)
}
- bit_count_u128 => {
- let field = MyFieldU128(U128);
- assert_eq!(u128::BITS as usize, MyFieldU128::BITS)
+ bit_count_u128 => {
+ let field = MyFieldU128(U128);
+ assert_eq!(u128::BITS as usize, MyFieldU128::BITS)
}
- bit_count_usize => {
- let field = MyFieldUsize(USIZE);
- assert_eq!(usize::BITS as usize, MyFieldUsize::BITS)
+ bit_count_usize => {
+ let field = MyFieldUsize(USIZE);
+ assert_eq!(usize::BITS as usize, MyFieldUsize::BITS)
}
}
- // byte count
- tests! {
- byte_count_u8 => {
- let field = MyFieldU8(U8);
- assert_eq!(1, MyFieldU8::BYTES)
+ // byte count
+ tests! {
+ byte_count_u8 => {
+ let field = MyFieldU8(U8);
+ assert_eq!(1, MyFieldU8::BYTES)
}
- byte_count_u16 => {
- let field = MyFieldU16(U16);
- assert_eq!(2, MyFieldU16::BYTES)
+ byte_count_u16 => {
+ let field = MyFieldU16(U16);
+ assert_eq!(2, MyFieldU16::BYTES)
}
- byte_count_u32 => {
- let field = MyFieldU32(U32);
- assert_eq!(4, MyFieldU32::BYTES)
+ byte_count_u32 => {
+ let field = MyFieldU32(U32);
+ assert_eq!(4, MyFieldU32::BYTES)
}
- byte_count_u64 => {
- let field = MyFieldU64(U64);
- assert_eq!(8, MyFieldU64::BYTES)
+ byte_count_u64 => {
+ let field = MyFieldU64(U64);
+ assert_eq!(8, MyFieldU64::BYTES)
}
- byte_count_u128 => {
- let field = MyFieldU128(U128);
- assert_eq!(16, MyFieldU128::BYTES)
+ byte_count_u128 => {
+ let field = MyFieldU128(U128);
+ assert_eq!(16, MyFieldU128::BYTES)
}
- byte_count_usize => {
- let field = MyFieldUsize(USIZE);
- assert_eq!((usize::BITS as usize) / 8, MyFieldUsize::BYTES)
+ byte_count_usize => {
+ let field = MyFieldUsize(USIZE);
+ assert_eq!((usize::BITS as usize) / 8, MyFieldUsize::BYTES)
}
}
- // integer value
- tests! {
- integer_u8 => {
- let field = MyFieldU8(U8);
- assert_eq!(U8, field.as_integer())
+ // integer value
+ tests! {
+ integer_u8 => {
+ let field = MyFieldU8(U8);
+ assert_eq!(U8, field.as_integer())
}
- integer_u16 => {
- let field = MyFieldU16(U16);
- assert_eq!(U16, field.as_integer())
+ integer_u16 => {
+ let field = MyFieldU16(U16);
+ assert_eq!(U16, field.as_integer())
}
- integer_u32 => {
- let field = MyFieldU32(U32);
- assert_eq!(U32, field.as_integer())
+ integer_u32 => {
+ let field = MyFieldU32(U32);
+ assert_eq!(U32, field.as_integer())
}
- integer_u64 => {
- let field = MyFieldU64(U64);
- assert_eq!(U64, field.as_integer())
+ integer_u64 => {
+ let field = MyFieldU64(U64);
+ assert_eq!(U64, field.as_integer())
}
- integer_u128 => {
- let field = MyFieldU128(U128);
- assert_eq!(U128, field.as_integer())
+ integer_u128 => {
+ let field = MyFieldU128(U128);
+ assert_eq!(U128, field.as_integer())
}
- integer_usize => {
- let field = MyFieldUsize(USIZE);
- assert_eq!(USIZE, field.as_integer())
+ integer_usize => {
+ let field = MyFieldUsize(USIZE);
+ assert_eq!(USIZE, field.as_integer())
}
}
- // binary value
- tests! {
- binary_u8 => {
- let field = MyFieldU8(U8);
- assert_eq!(B8, field.as_binary())
+ // binary value
+ tests! {
+ binary_u8 => {
+ let field = MyFieldU8(U8);
+ assert_eq!(B8, field.as_binary())
}
- binary_u16 => {
- let field = MyFieldU16(U16);
- assert_eq!(B16, field.as_binary())
+ binary_u16 => {
+ let field = MyFieldU16(U16);
+ assert_eq!(B16, field.as_binary())
}
- binary_u32 => {
- let field = MyFieldU32(U32);
- assert_eq!(B32, field.as_binary())
+ binary_u32 => {
+ let field = MyFieldU32(U32);
+ assert_eq!(B32, field.as_binary())
}
- binary_u64 => {
- let field = MyFieldU64(U64);
- assert_eq!(B64, field.as_binary())
+ binary_u64 => {
+ let field = MyFieldU64(U64);
+ assert_eq!(B64, field.as_binary())
}
- binary_u128 => {
- let field = MyFieldU128(U128);
- assert_eq!(B128, field.as_binary())
+ binary_u128 => {
+ let field = MyFieldU128(U128);
+ assert_eq!(B128, field.as_binary())
}
- binary_usize => {
- let field = MyFieldUsize(USIZE);
- assert_eq!(BSIZE, field.as_binary())
+ binary_usize => {
+ let field = MyFieldUsize(USIZE);
+ assert_eq!(BSIZE, field.as_binary())
}
}
- // get index
- tests! {
- get_index_u8 => {
- let field = MyFieldU8(U8);
- for (index, char) in B8.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8))
- } else if char == '0' {
- assert!(!field.get_index(index as u8))
- } else {
+ // get index
+ tests! {
+ get_index_u8 => {
+ let field = MyFieldU8(U8);
+ for (index, char) in B8.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8))
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_index_u16 => {
- let field = MyFieldU16(U16);
- for (index, char) in B16.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8))
- } else if char == '0' {
- assert!(!field.get_index(index as u8))
- } else {
+ get_index_u16 => {
+ let field = MyFieldU16(U16);
+ for (index, char) in B16.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8))
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_index_u32 => {
- let field = MyFieldU32(U32);
- for (index, char) in B32.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8))
- } else if char == '0' {
- assert!(!field.get_index(index as u8))
- } else {
+ get_index_u32 => {
+ let field = MyFieldU32(U32);
+ for (index, char) in B32.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8))
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_index_u64 => {
- let field = MyFieldU64(U64);
- for (index, char) in B64.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8))
- } else if char == '0' {
- assert!(!field.get_index(index as u8))
- } else {
+ get_index_u64 => {
+ let field = MyFieldU64(U64);
+ for (index, char) in B64.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8))
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_index_u128 => {
- let field = MyFieldU128(U128);
- for (index, char) in B128.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8))
- } else if char == '0' {
- assert!(!field.get_index(index as u8))
- } else {
+ get_index_u128 => {
+ let field = MyFieldU128(U128);
+ for (index, char) in B128.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8))
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_index_usize => {
- let field = MyFieldUsize(USIZE);
- for (index, char) in BSIZE.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8))
- } else if char == '0' {
- assert!(!field.get_index(index as u8))
- } else {
+ get_index_usize => {
+ let field = MyFieldUsize(USIZE);
+ for (index, char) in BSIZE.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8))
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8))
+ } else {
panic!("invalid char in binary string")
}
}
}
}
- // set index
- tests! {
- set_index_u8 => {
- let mut field = MyFieldU8(0);
- for (index, char) in B8.chars().rev().enumerate() {
- field.set_index(index as u8);
- for (s_index, _char) in B8.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ // set index
+ tests! {
+ set_index_u8 => {
+ let mut field = MyFieldU8(0);
+ for (index, char) in B8.chars().rev().enumerate() {
+ field.set_index(index as u8);
+ for (s_index, _char) in B8.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_index_u16 => {
- let mut field = MyFieldU16(0);
- for (index, char) in B16.chars().rev().enumerate() {
- field.set_index(index as u8);
- for (s_index, _char) in B16.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_index_u16 => {
+ let mut field = MyFieldU16(0);
+ for (index, char) in B16.chars().rev().enumerate() {
+ field.set_index(index as u8);
+ for (s_index, _char) in B16.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_index_u32 => {
- let mut field = MyFieldU32(0);
- for (index, char) in B32.chars().rev().enumerate() {
- field.set_index(index as u8);
- for (s_index, _char) in B32.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_index_u32 => {
+ let mut field = MyFieldU32(0);
+ for (index, char) in B32.chars().rev().enumerate() {
+ field.set_index(index as u8);
+ for (s_index, _char) in B32.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_index_u64 => {
- let mut field = MyFieldU64(0);
- for (index, char) in B64.chars().rev().enumerate() {
- field.set_index(index as u8);
- for (s_index, _char) in B64.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_index_u64 => {
+ let mut field = MyFieldU64(0);
+ for (index, char) in B64.chars().rev().enumerate() {
+ field.set_index(index as u8);
+ for (s_index, _char) in B64.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_index_u128 => {
- let mut field = MyFieldU128(0);
- for (index, char) in B128.chars().rev().enumerate() {
- field.set_index(index as u8);
- for (s_index, _char) in B128.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_index_u128 => {
+ let mut field = MyFieldU128(0);
+ for (index, char) in B128.chars().rev().enumerate() {
+ field.set_index(index as u8);
+ for (s_index, _char) in B128.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_index_usize => {
- let mut field = MyFieldUsize(0);
- for (index, char) in BSIZE.chars().rev().enumerate() {
- field.set_index(index as u8);
- for (s_index, _char) in BSIZE.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_index_usize => {
+ let mut field = MyFieldUsize(0);
+ for (index, char) in BSIZE.chars().rev().enumerate() {
+ field.set_index(index as u8);
+ for (s_index, _char) in BSIZE.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
}
- // clear index
- tests! {
- clear_index_u8 => {
- let mut field = MyFieldU8(u8::MAX);
- for (index, char) in B8.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear_index(index as u8);
- for (s_index, _char) in B8.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ // clear index
+ tests! {
+ clear_index_u8 => {
+ let mut field = MyFieldU8(u8::MAX);
+ for (index, char) in B8.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear_index(index as u8);
+ for (s_index, _char) in B8.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_index_u16 => {
- let mut field = MyFieldU16(u16::MAX);
- for (index, char) in B16.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear_index(index as u8);
- for (s_index, _char) in B16.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_index_u16 => {
+ let mut field = MyFieldU16(u16::MAX);
+ for (index, char) in B16.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear_index(index as u8);
+ for (s_index, _char) in B16.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_index_u32 => {
- let mut field = MyFieldU32(u32::MAX);
- for (index, char) in B32.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear_index(index as u8);
- for (s_index, _char) in B32.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_index_u32 => {
+ let mut field = MyFieldU32(u32::MAX);
+ for (index, char) in B32.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear_index(index as u8);
+ for (s_index, _char) in B32.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_index_u64 => {
- let mut field = MyFieldU64(u64::MAX);
- for (index, char) in B64.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear_index(index as u8);
- for (s_index, _char) in B64.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_index_u64 => {
+ let mut field = MyFieldU64(u64::MAX);
+ for (index, char) in B64.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear_index(index as u8);
+ for (s_index, _char) in B64.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_index_u128 => {
- let mut field = MyFieldU128(u128::MAX);
- for (index, char) in B128.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear_index(index as u8);
- for (s_index, _char) in B128.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_index_u128 => {
+ let mut field = MyFieldU128(u128::MAX);
+ for (index, char) in B128.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear_index(index as u8);
+ for (s_index, _char) in B128.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_index_usize => {
- let mut field = MyFieldUsize(usize::MAX);
- for (index, char) in BSIZE.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear_index(index as u8);
- for (s_index, _char) in BSIZE.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_index_usize => {
+ let mut field = MyFieldUsize(usize::MAX);
+ for (index, char) in BSIZE.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear_index(index as u8);
+ for (s_index, _char) in BSIZE.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
}
- // toggle index
- tests! {
- toggle_index_u8 => {
- let mut field = MyFieldU8(U8);
- for (index, char) in B8.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(field.get_index(index as u8));
- } else {
+ // toggle index
+ tests! {
+ toggle_index_u8 => {
+ let mut field = MyFieldU8(U8);
+ for (index, char) in B8.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string");
}
}
}
- toggle_index_u16 => {
- let mut field = MyFieldU16(U16);
- for (index, char) in B16.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(field.get_index(index as u8));
- } else {
+ toggle_index_u16 => {
+ let mut field = MyFieldU16(U16);
+ for (index, char) in B16.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
- toggle_index_u32 => {
- let mut field = MyFieldU32(U32);
- for (index, char) in B32.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(field.get_index(index as u8));
- } else {
+ toggle_index_u32 => {
+ let mut field = MyFieldU32(U32);
+ for (index, char) in B32.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
- toggle_index_u64 => {
- let mut field = MyFieldU64(U64);
- for (index, char) in B64.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(field.get_index(index as u8));
- } else {
+ toggle_index_u64 => {
+ let mut field = MyFieldU64(U64);
+ for (index, char) in B64.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
- toggle_index_u128 => {
- let mut field = MyFieldU128(U128);
- for (index, char) in B128.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(field.get_index(index as u8));
- } else {
+ toggle_index_u128 => {
+ let mut field = MyFieldU128(U128);
+ for (index, char) in B128.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
- toggle_index_usize => {
- let mut field = MyFieldUsize(USIZE);
- for (index, char) in BSIZE.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle_index(index as u8);
- assert!(field.get_index(index as u8));
- } else {
+ toggle_index_usize => {
+ let mut field = MyFieldUsize(USIZE);
+ for (index, char) in BSIZE.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle_index(index as u8);
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
}
- // get
- tests! {
- get_u8 => {
- let field = MyFieldU8(U8);
- for (index, char) in B8.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get(MyFlagsU8::from(index as u8)))
- } else if char == '0' {
- assert!(!field.get(MyFlagsU8::from(index as u8)))
- } else {
+ // get
+ tests! {
+ get_u8 => {
+ let field = MyFieldU8(U8);
+ for (index, char) in B8.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get(MyFlagsU8::from(index as u8)))
+ } else if char == '0' {
+ assert!(!field.get(MyFlagsU8::from(index as u8)))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_u16 => {
- let field = MyFieldU16(U16);
- for (index, char) in B16.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get(MyFlagsU16::from(index as u8)))
- } else if char == '0' {
- assert!(!field.get(MyFlagsU16::from(index as u8)))
- } else {
+ get_u16 => {
+ let field = MyFieldU16(U16);
+ for (index, char) in B16.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get(MyFlagsU16::from(index as u8)))
+ } else if char == '0' {
+ assert!(!field.get(MyFlagsU16::from(index as u8)))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_u32 => {
- let field = MyFieldU32(U32);
- for (index, char) in B32.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get(MyFlagsU32::from(index as u8)))
- } else if char == '0' {
- assert!(!field.get(MyFlagsU32::from(index as u8)))
- } else {
+ get_u32 => {
+ let field = MyFieldU32(U32);
+ for (index, char) in B32.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get(MyFlagsU32::from(index as u8)))
+ } else if char == '0' {
+ assert!(!field.get(MyFlagsU32::from(index as u8)))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_u64 => {
- let field = MyFieldU64(U64);
- for (index, char) in B64.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get(MyFlagsU64::from(index as u8)))
- } else if char == '0' {
- assert!(!field.get(MyFlagsU64::from(index as u8)))
- } else {
+ get_u64 => {
+ let field = MyFieldU64(U64);
+ for (index, char) in B64.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get(MyFlagsU64::from(index as u8)))
+ } else if char == '0' {
+ assert!(!field.get(MyFlagsU64::from(index as u8)))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_u128 => {
- let field = MyFieldU128(U128);
- for (index, char) in B128.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get(MyFlagsU128::from(index as u8)))
- } else if char == '0' {
- assert!(!field.get(MyFlagsU128::from(index as u8)))
- } else {
+ get_u128 => {
+ let field = MyFieldU128(U128);
+ for (index, char) in B128.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get(MyFlagsU128::from(index as u8)))
+ } else if char == '0' {
+ assert!(!field.get(MyFlagsU128::from(index as u8)))
+ } else {
panic!("invalid char in binary string")
}
}
}
- get_usize => {
- let field = MyFieldUsize(USIZE);
- for (index, char) in BSIZE.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get(MyFlagsUsize::from(index as u8)))
- } else if char == '0' {
- assert!(!field.get(MyFlagsUsize::from(index as u8)))
- } else {
+ get_usize => {
+ let field = MyFieldUsize(USIZE);
+ for (index, char) in BSIZE.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get(MyFlagsUsize::from(index as u8)))
+ } else if char == '0' {
+ assert!(!field.get(MyFlagsUsize::from(index as u8)))
+ } else {
panic!("invalid char in binary string")
}
}
}
}
- // set
- tests! {
- set_u8 => {
- let mut field = MyFieldU8(0);
- for (index, char) in B8.chars().rev().enumerate() {
- field.set(MyFlagsU8::from(index as u8));
- for (s_index, _char) in B8.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ // set
+ tests! {
+ set_u8 => {
+ let mut field = MyFieldU8(0);
+ for (index, char) in B8.chars().rev().enumerate() {
+ field.set(MyFlagsU8::from(index as u8));
+ for (s_index, _char) in B8.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_u16 => {
- let mut field = MyFieldU16(0);
- for (index, char) in B16.chars().rev().enumerate() {
- field.set(MyFlagsU16::from(index as u8));
- for (s_index, _char) in B16.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_u16 => {
+ let mut field = MyFieldU16(0);
+ for (index, char) in B16.chars().rev().enumerate() {
+ field.set(MyFlagsU16::from(index as u8));
+ for (s_index, _char) in B16.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_u32 => {
- let mut field = MyFieldU32(0);
- for (index, char) in B32.chars().rev().enumerate() {
- field.set(MyFlagsU32::from(index as u8));
- for (s_index, _char) in B32.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_u32 => {
+ let mut field = MyFieldU32(0);
+ for (index, char) in B32.chars().rev().enumerate() {
+ field.set(MyFlagsU32::from(index as u8));
+ for (s_index, _char) in B32.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_u64 => {
- let mut field = MyFieldU64(0);
- for (index, char) in B64.chars().rev().enumerate() {
- field.set(MyFlagsU64::from(index as u8));
- for (s_index, _char) in B64.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_u64 => {
+ let mut field = MyFieldU64(0);
+ for (index, char) in B64.chars().rev().enumerate() {
+ field.set(MyFlagsU64::from(index as u8));
+ for (s_index, _char) in B64.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_u128 => {
- let mut field = MyFieldU128(0);
- for (index, char) in B128.chars().rev().enumerate() {
- field.set(MyFlagsU128::from(index as u8));
- for (s_index, _char) in B128.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_u128 => {
+ let mut field = MyFieldU128(0);
+ for (index, char) in B128.chars().rev().enumerate() {
+ field.set(MyFlagsU128::from(index as u8));
+ for (s_index, _char) in B128.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- set_usize => {
- let mut field = MyFieldUsize(0);
- for (index, char) in BSIZE.chars().rev().enumerate() {
- field.set(MyFlagsUsize::from(index as u8));
- for (s_index, _char) in BSIZE.chars().rev().enumerate() {
- if s_index <= index {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ set_usize => {
+ let mut field = MyFieldUsize(0);
+ for (index, char) in BSIZE.chars().rev().enumerate() {
+ field.set(MyFlagsUsize::from(index as u8));
+ for (s_index, _char) in BSIZE.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
}
- // clear
- tests! {
- clear_u8 => {
- let mut field = MyFieldU8(u8::MAX);
- for (index, char) in B8.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear(MyFlagsU8::from(index as u8));
- for (s_index, _char) in B8.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ // clear
+ tests! {
+ clear_u8 => {
+ let mut field = MyFieldU8(u8::MAX);
+ for (index, char) in B8.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear(MyFlagsU8::from(index as u8));
+ for (s_index, _char) in B8.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_u16 => {
- let mut field = MyFieldU16(u16::MAX);
- for (index, char) in B16.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear(MyFlagsU16::from(index as u8));
- for (s_index, _char) in B16.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_u16 => {
+ let mut field = MyFieldU16(u16::MAX);
+ for (index, char) in B16.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear(MyFlagsU16::from(index as u8));
+ for (s_index, _char) in B16.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_u32 => {
- let mut field = MyFieldU32(u32::MAX);
- for (index, char) in B32.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear(MyFlagsU32::from(index as u8));
- for (s_index, _char) in B32.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_u32 => {
+ let mut field = MyFieldU32(u32::MAX);
+ for (index, char) in B32.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear(MyFlagsU32::from(index as u8));
+ for (s_index, _char) in B32.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_u64 => {
- let mut field = MyFieldU64(u64::MAX);
- for (index, char) in B64.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear(MyFlagsU64::from(index as u8));
- for (s_index, _char) in B64.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_u64 => {
+ let mut field = MyFieldU64(u64::MAX);
+ for (index, char) in B64.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear(MyFlagsU64::from(index as u8));
+ for (s_index, _char) in B64.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_u128 => {
- let mut field = MyFieldU128(u128::MAX);
- for (index, char) in B128.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear(MyFlagsU128::from(index as u8));
- for (s_index, _char) in B128.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_u128 => {
+ let mut field = MyFieldU128(u128::MAX);
+ for (index, char) in B128.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear(MyFlagsU128::from(index as u8));
+ for (s_index, _char) in B128.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
- clear_usize => {
- let mut field = MyFieldUsize(usize::MAX);
- for (index, char) in BSIZE.chars().rev().enumerate() {
- assert!(field.get_index(index as u8), "{:#?}", field);
- field.clear(MyFlagsUsize::from(index as u8));
- for (s_index, _char) in BSIZE.chars().rev().enumerate() {
- if s_index <= index {
- assert!(!field.get_index(s_index as u8), "{:#?}", field);
- } else {
- assert!(field.get_index(s_index as u8), "{:#?}", field);
+ clear_usize => {
+ let mut field = MyFieldUsize(usize::MAX);
+ for (index, char) in BSIZE.chars().rev().enumerate() {
+ assert!(field.get_index(index as u8), "{:#?}", field);
+ field.clear(MyFlagsUsize::from(index as u8));
+ for (s_index, _char) in BSIZE.chars().rev().enumerate() {
+ if s_index <= index {
+ assert!(!field.get_index(s_index as u8), "{:#?}", field);
+ } else {
+ assert!(field.get_index(s_index as u8), "{:#?}", field);
}
}
}
}
}
- // toggle
- tests! {
- toggle_u8 => {
- let mut field = MyFieldU8(U8);
- for (index, char) in B8.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle(MyFlagsU8::from(index as u8));
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle(MyFlagsU8::from(index as u8));
- assert!(field.get_index(index as u8));
- } else {
+ // toggle
+ tests! {
+ toggle_u8 => {
+ let mut field = MyFieldU8(U8);
+ for (index, char) in B8.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle(MyFlagsU8::from(index as u8));
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle(MyFlagsU8::from(index as u8));
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string");
}
}
}
- toggle_u16 => {
- let mut field = MyFieldU16(U16);
- for (index, char) in B16.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle(MyFlagsU16::from(index as u8));
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle(MyFlagsU16::from(index as u8));
- assert!(field.get_index(index as u8));
- } else {
+ toggle_u16 => {
+ let mut field = MyFieldU16(U16);
+ for (index, char) in B16.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle(MyFlagsU16::from(index as u8));
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle(MyFlagsU16::from(index as u8));
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
- toggle_u32 => {
- let mut field = MyFieldU32(U32);
- for (index, char) in B32.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle(MyFlagsU32::from(index as u8));
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle(MyFlagsU32::from(index as u8));
- assert!(field.get_index(index as u8));
- } else {
+ toggle_u32 => {
+ let mut field = MyFieldU32(U32);
+ for (index, char) in B32.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle(MyFlagsU32::from(index as u8));
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle(MyFlagsU32::from(index as u8));
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
- toggle_u64 => {
- let mut field = MyFieldU64(U64);
- for (index, char) in B64.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle(MyFlagsU64::from(index as u8));
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle(MyFlagsU64::from(index as u8));
- assert!(field.get_index(index as u8));
- } else {
+ toggle_u64 => {
+ let mut field = MyFieldU64(U64);
+ for (index, char) in B64.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle(MyFlagsU64::from(index as u8));
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle(MyFlagsU64::from(index as u8));
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
- toggle_u128 => {
- let mut field = MyFieldU128(U128);
- for (index, char) in B128.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle(MyFlagsU128::from(index as u8));
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle(MyFlagsU128::from(index as u8));
- assert!(field.get_index(index as u8));
- } else {
+ toggle_u128 => {
+ let mut field = MyFieldU128(U128);
+ for (index, char) in B128.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle(MyFlagsU128::from(index as u8));
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle(MyFlagsU128::from(index as u8));
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
- toggle_usize => {
- let mut field = MyFieldUsize(USIZE);
- for (index, char) in BSIZE.chars().rev().enumerate() {
- if char == '1' {
- assert!(field.get_index(index as u8));
- field.toggle(MyFlagsUsize::from(index as u8));
- assert!(!field.get_index(index as u8));
- } else if char == '0' {
- assert!(!field.get_index(index as u8));
- field.toggle(MyFlagsUsize::from(index as u8));
- assert!(field.get_index(index as u8));
- } else {
+ toggle_usize => {
+ let mut field = MyFieldUsize(USIZE);
+ for (index, char) in BSIZE.chars().rev().enumerate() {
+ if char == '1' {
+ assert!(field.get_index(index as u8));
+ field.toggle(MyFlagsUsize::from(index as u8));
+ assert!(!field.get_index(index as u8));
+ } else if char == '0' {
+ assert!(!field.get_index(index as u8));
+ field.toggle(MyFlagsUsize::from(index as u8));
+ assert!(field.get_index(index as u8));
+ } else {
panic!("invalid char in binary string")
}
}
}
}
- // diff
- tests! {
- diff_u8 => {
- let field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.diff(reversed);
- assert_eq!("10100101", out.as_binary());
- assert_eq!(165, out.as_integer());
- }
- diff_u16 => {
- let field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.diff(reversed);
- assert_eq!("1010101111010101", out.as_binary());
- assert_eq!(43989, out.as_integer());
- }
- diff_u32 => {
- let field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.diff(reversed);
- assert_eq!("11110101000100111100100010101111", out.as_binary());
- assert_eq!(4111714479, out.as_integer());
- }
- diff_u64 => {
- let field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.diff(reversed);
- assert_eq!("0001010011000010001001001001100110011001001001000100001100101000", out.as_binary());
- assert_eq!(1495798268358312744, out.as_integer());
- }
- diff_u128 => {
- let field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.diff(reversed);
- assert_eq!("10010001110011001000001110100101110101111000111101001010101000100100010101010010111100011110101110100101110000010011001110001001", out.as_binary());
- assert_eq!(193799958082971305581995159990093034377, out.as_integer());
- }
- // diff_usize => {
- // let field = MyFieldUsize(USIZE);
- // }
- }
-
- // combine
- tests! {
- combine_u8 => {
- let field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.combine(reversed);
- assert_eq!("11111111", out.as_binary());
- assert_eq!(255, out.as_integer());
- }
- combine_u16 => {
- let field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.combine(reversed);
- assert_eq!("1110101111010111", out.as_binary());
- assert_eq!(60375, out.as_integer());
- }
- combine_u32 => {
- let field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.combine(reversed);
- assert_eq!("11111101100100111100100110111111", out.as_binary());
- assert_eq!(4254321087, out.as_integer());
- }
- combine_u64 => {
- let field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.combine(reversed);
- assert_eq!("1111111011010010001111111001110110111001111111000100101101111111", out.as_binary());
- assert_eq!(18361808577405668223, out.as_integer());
- }
- combine_u128 => {
- let field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.combine(reversed);
- assert_eq!("11111001111111011110001110100101111101111110111101101011111111111111111111010110111101111110111110100101110001111011111110011111", out.as_binary());
- assert_eq!(332296039312012448238196841470979719071, out.as_integer());
- }
- // combine_usize => {
- // let field = MyFieldUsize(USIZE);
- // }
- }
-
- // intersect
- tests! {
- intersect_u8 => {
- let field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.intersect(reversed);
- assert_eq!("01011010", out.as_binary());
- assert_eq!(90, out.as_integer());
- }
- intersect_u16 => {
- let field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.intersect(reversed);
- assert_eq!("0100000000000010", out.as_binary());
- assert_eq!(16386, out.as_integer());
- }
- intersect_u32 => {
- let field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.intersect(reversed);
- assert_eq!("00001000100000000000000100010000", out.as_binary());
- assert_eq!(142606608, out.as_integer());
- }
- intersect_u64 => {
- let field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.intersect(reversed);
- assert_eq!("1110101000010000000110110000010000100000110110000000100001010111", out.as_binary());
- assert_eq!(16866010309047355479, out.as_integer());
- }
- intersect_u128 => {
- let field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.intersect(reversed);
- assert_eq!("01101000001100010110000000000000001000000110000000100001010111011011101010000100000001100000010000000000000001101000110000010110", out.as_binary());
- assert_eq!(138496081229041142656201681480886684694, out.as_integer());
- }
- // intersect_usize => {
- // let field = MyFieldUsize(USIZE);
- // }
- }
-
- // into diff
- tests! {
- into_diff_u8 => {
- let field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_diff(reversed);
- assert_eq!("10100101", out.as_binary());
- assert_eq!(165, out.as_integer());
- }
- into_diff_u16 => {
- let field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_diff(reversed);
- assert_eq!("1010101111010101", out.as_binary());
- assert_eq!(43989, out.as_integer());
- }
- into_diff_u32 => {
- let field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_diff(reversed);
- assert_eq!("11110101000100111100100010101111", out.as_binary());
- assert_eq!(4111714479, out.as_integer());
- }
- into_diff_u64 => {
- let field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_diff(reversed);
- assert_eq!("0001010011000010001001001001100110011001001001000100001100101000", out.as_binary());
- assert_eq!(1495798268358312744, out.as_integer());
- }
- into_diff_u128 => {
- let field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_diff(reversed);
- assert_eq!("10010001110011001000001110100101110101111000111101001010101000100100010101010010111100011110101110100101110000010011001110001001", out.as_binary());
- assert_eq!(193799958082971305581995159990093034377, out.as_integer());
- }
- // into_diff_usize => {
- // let field = MyFieldUsize(USIZE);
- // }
- }
-
- // into combined
- tests! {
- into_combined_u8 => {
- let field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_combined(reversed);
- assert_eq!("11111111", out.as_binary());
- assert_eq!(255, out.as_integer());
- }
- into_combined_u16 => {
- let field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_combined(reversed);
- assert_eq!("1110101111010111", out.as_binary());
- assert_eq!(60375, out.as_integer());
- }
- into_combined_u32 => {
- let field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_combined(reversed);
- assert_eq!("11111101100100111100100110111111", out.as_binary());
- assert_eq!(4254321087, out.as_integer());
- }
- into_combined_u64 => {
- let field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_combined(reversed);
- assert_eq!("1111111011010010001111111001110110111001111111000100101101111111", out.as_binary());
- assert_eq!(18361808577405668223, out.as_integer());
- }
- into_combined_u128 => {
- let field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_combined(reversed);
- assert_eq!("11111001111111011110001110100101111101111110111101101011111111111111111111010110111101111110111110100101110001111011111110011111", out.as_binary());
- assert_eq!(332296039312012448238196841470979719071, out.as_integer());
- }
- // into_combined_usize => {
- // let field = MyFieldUsize(USIZE);
- // }
- }
-
- // into intersection
- tests! {
- into_intersection_u8 => {
- let field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_intersection(reversed);
- assert_eq!("01011010", out.as_binary());
- assert_eq!(90, out.as_integer());
- }
- into_intersection_u16 => {
- let field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_intersection(reversed);
- assert_eq!("0100000000000010", out.as_binary());
- assert_eq!(16386, out.as_integer());
- }
- into_intersection_u32 => {
- let field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_intersection(reversed);
- assert_eq!("00001000100000000000000100010000", out.as_binary());
- assert_eq!(142606608, out.as_integer());
- }
- into_intersection_u64 => {
- let field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_intersection(reversed);
- assert_eq!("1110101000010000000110110000010000100000110110000000100001010111", out.as_binary());
- assert_eq!(16866010309047355479, out.as_integer());
- }
- into_intersection_u128 => {
- let field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field.into_intersection(reversed);
- assert_eq!("01101000001100010110000000000000001000000110000000100001010111011011101010000100000001100000010000000000000001101000110000010110", out.as_binary());
- assert_eq!(138496081229041142656201681480886684694, out.as_integer());
- }
- // into_intersection_usize => {
- // let field = MyFieldUsize(USIZE);
- // }
- }
-
- // field from flag
- tests! {
- field_from_flag_u8 => {
- for index in 0..u8::BITS {
- let flag = MyFlagsU8::from(index as u8);
- let field = MyFieldU8::from(flag);
- assert_eq!(MyFieldU8(0u8 | (1 << index)), field)
- }
- }
- field_from_flag_u16 => {
- for index in 0..u16::BITS {
- let flag = MyFlagsU16::from(index as u8);
- let field = MyFieldU16::from(flag);
- assert_eq!(MyFieldU16(0u16 | (1 << index)), field)
- }
- }
- field_from_flag_u32 => {
- for index in 0..u32::BITS {
- let flag = MyFlagsU32::from(index as u8);
- let field = MyFieldU32::from(flag);
- assert_eq!(MyFieldU32(0u32 | (1 << index)), field)
- }
- }
- field_from_flag_u64 => {
- for index in 0..u64::BITS {
- let flag = MyFlagsU64::from(index as u8);
- let field = MyFieldU64::from(flag);
- assert_eq!(MyFieldU64(0u64 | (1 << index)), field)
- }
- }
- field_from_flag_u128 => {
- for index in 0..u128::BITS {
- let flag = MyFlagsU128::from(index as u8);
- let field = MyFieldU128::from(flag);
- assert_eq!(MyFieldU128(0u128 | (1 << index)), field)
- }
- }
- field_from_flag_usize => {
- for index in 0..usize::BITS {
- let flag = MyFlagsUsize::from(index as u8);
- let field = MyFieldUsize::from(flag);
- assert_eq!(MyFieldUsize(0usize | (1 << index)), field)
- }
- }
- }
-
- // $name & $name
- tests! {
- bitwise_name_and_name_u8 => {
- let field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field & reversed;
- assert_eq!("01011010", out.as_binary());
- assert_eq!(90, out.as_integer());
- }
- bitwise_name_and_name_u16 => {
- let field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field & reversed;
- assert_eq!("0100000000000010", out.as_binary());
- assert_eq!(16386, out.as_integer());
- }
- bitwise_name_and_name_u32 => {
- let field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field & reversed;
- assert_eq!("00001000100000000000000100010000", out.as_binary());
- assert_eq!(142606608, out.as_integer());
- }
- bitwise_name_and_name_u64 => {
- let field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field & reversed;
- assert_eq!("1110101000010000000110110000010000100000110110000000100001010111", out.as_binary());
- assert_eq!(16866010309047355479, out.as_integer());
- }
- bitwise_name_and_name_u128 => {
- let field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field & reversed;
- assert_eq!("01101000001100010110000000000000001000000110000000100001010111011011101010000100000001100000010000000000000001101000110000010110", out.as_binary());
- assert_eq!(138496081229041142656201681480886684694, out.as_integer());
- }
- // bitwise_name_and_name_usize => {
- //
- // }
- }
-
- // $name | $name
- tests! {
- bitwise_name_or_name_u8 => {
- let field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field | reversed;
- assert_eq!("11111111", out.as_binary());
- assert_eq!(255, out.as_integer());
- }
- bitwise_name_or_name_u16 => {
- let field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field | reversed;
- assert_eq!("1110101111010111", out.as_binary());
- assert_eq!(60375, out.as_integer());
- }
- bitwise_name_or_name_u32 => {
- let field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field | reversed;
- assert_eq!("11111101100100111100100110111111", out.as_binary());
- assert_eq!(4254321087, out.as_integer());
- }
- bitwise_name_or_name_u64 => {
- let field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field | reversed;
- assert_eq!("1111111011010010001111111001110110111001111111000100101101111111", out.as_binary());
- assert_eq!(18361808577405668223, out.as_integer());
- }
- bitwise_name_or_name_u128 => {
- let field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field | reversed;
- assert_eq!("11111001111111011110001110100101111101111110111101101011111111111111111111010110111101111110111110100101110001111011111110011111", out.as_binary());
- assert_eq!(332296039312012448238196841470979719071, out.as_integer());
- }
- // bitwise_name_or_name_usize => {
- //
- // }
- }
-
- // $name ^ $name
- tests! {
- bitwise_name_xor_name_u8 => {
- let field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field ^ reversed;
- assert_eq!("10100101", out.as_binary());
- assert_eq!(165, out.as_integer());
- }
- bitwise_name_xor_name_u16 => {
- let field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field ^ reversed;
- assert_eq!("1010101111010101", out.as_binary());
- assert_eq!(43989, out.as_integer());
- }
- bitwise_name_xor_name_u32 => {
- let field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field ^ reversed;
- assert_eq!("11110101000100111100100010101111", out.as_binary());
- assert_eq!(4111714479, out.as_integer());
- }
- bitwise_name_xor_name_u64 => {
- let field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field ^ reversed;
- assert_eq!("0001010011000010001001001001100110011001001001000100001100101000", out.as_binary());
- assert_eq!(1495798268358312744, out.as_integer());
- }
- bitwise_name_xor_name_u128 => {
- let field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- let out = field ^ reversed;
- assert_eq!("10010001110011001000001110100101110101111000111101001010101000100100010101010010111100011110101110100101110000010011001110001001", out.as_binary());
- assert_eq!(193799958082971305581995159990093034377, out.as_integer());
- }
- // bitwise_name_xor_name_usize => {
- //
- // }
- }
-
- // $name &= $name
- tests! {
- bitwise_name_and_assign_name_u8 => {
- let mut field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field &= reversed;
- assert_eq!("01011010", field.as_binary());
- assert_eq!(90, field.as_integer());
- }
- bitwise_name_and_assign_name_u16 => {
- let mut field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field &= reversed;
- assert_eq!("0100000000000010", field.as_binary());
- assert_eq!(16386, field.as_integer());
- }
- bitwise_name_and_assign_name_u32 => {
- let mut field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field &= reversed;
- assert_eq!("00001000100000000000000100010000", field.as_binary());
- assert_eq!(142606608, field.as_integer());
- }
- bitwise_name_and_assign_name_u64 => {
- let mut field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field &= reversed;
- assert_eq!("1110101000010000000110110000010000100000110110000000100001010111", field.as_binary());
- assert_eq!(16866010309047355479, field.as_integer());
- }
- bitwise_name_and_assign_name_u128 => {
- let mut field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field &= reversed;
- assert_eq!("01101000001100010110000000000000001000000110000000100001010111011011101010000100000001100000010000000000000001101000110000010110", field.as_binary());
- assert_eq!(138496081229041142656201681480886684694, field.as_integer());
- }
- // bitwise_name_and_assign_name_usize => {
- //
- // }
- }
-
- // $name |= $name
- tests! {
- bitwise_name_or_assign_name_u8 => {
- let mut field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field |= reversed;
- assert_eq!("11111111", field.as_binary());
- assert_eq!(255, field.as_integer());
- }
- bitwise_name_or_assign_name_u16 => {
- let mut field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field |= reversed;
- assert_eq!("1110101111010111", field.as_binary());
- assert_eq!(60375, field.as_integer());
- }
- bitwise_name_or_assign_name_u32 => {
- let mut field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field |= reversed;
- assert_eq!("11111101100100111100100110111111", field.as_binary());
- assert_eq!(4254321087, field.as_integer());
- }
- bitwise_name_or_assign_name_u64 => {
- let mut field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field |= reversed;
- assert_eq!("1111111011010010001111111001110110111001111111000100101101111111", field.as_binary());
- assert_eq!(18361808577405668223, field.as_integer());
- }
- bitwise_name_or_assign_name_u128 => {
- let mut field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field |= reversed;
- assert_eq!("11111001111111011110001110100101111101111110111101101011111111111111111111010110111101111110111110100101110001111011111110011111", field.as_binary());
- assert_eq!(332296039312012448238196841470979719071, field.as_integer());
- }
- // bitwise_name_or_assign_name_usize => {
- //
- // }
- }
-
- // $name ^= $name
- tests! {
- bitwise_name_xor_assign_name_u8 => {
- let mut field = MyFieldU8(U8);
- let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field ^= reversed;
- assert_eq!("10100101", field.as_binary());
- assert_eq!(165, field.as_integer());
- }
- bitwise_name_xor_assign_name_u16 => {
- let mut field = MyFieldU16(U16);
- let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field ^= reversed;
- assert_eq!("1010101111010101", field.as_binary());
- assert_eq!(43989, field.as_integer());
- }
- bitwise_name_xor_assign_name_u32 => {
- let mut field = MyFieldU32(U32);
- let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field ^= reversed;
- assert_eq!("11110101000100111100100010101111", field.as_binary());
- assert_eq!(4111714479, field.as_integer());
- }
- bitwise_name_xor_assign_name_u64 => {
- let mut field = MyFieldU64(U64);
- let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field ^= reversed;
- assert_eq!("0001010011000010001001001001100110011001001001000100001100101000", field.as_binary());
- assert_eq!(1495798268358312744, field.as_integer());
- }
- bitwise_name_xor_assign_name_u128 => {
- let mut field = MyFieldU128(U128);
- let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
- field ^= reversed;
- assert_eq!("10010001110011001000001110100101110101111000111101001010101000100100010101010010111100011110101110100101110000010011001110001001", field.as_binary());
- assert_eq!(193799958082971305581995159990093034377, field.as_integer());
- }
- // bitwise_name_xor_assign_name_usize => {
- //
- // }
- }
-
- // $name & $flag
- tests! {
- bitwise_name_and_flag_u8 => {
- for index in 0..u8::BITS {
- let mask = MyFieldU8(u8::MAX) & MyFlagsU8::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
- }
- }
- bitwise_name_and_flag_u16 => {
- for index in 0..u16::BITS {
- let mask = MyFieldU16(u16::MAX) & MyFlagsU16::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
- }
- }
- bitwise_name_and_flag_u32 => {
- for index in 0..u32::BITS {
- let mask = MyFieldU32(u32::MAX) & MyFlagsU32::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
- }
- }
- bitwise_name_and_flag_u64 => {
- for index in 0..u64::BITS {
- let mask = MyFieldU64(u64::MAX) & MyFlagsU64::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ // diff
+ tests! {
+ diff_u8 => {
+ let field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.diff(reversed);
+ assert_eq!("10100101", out.as_binary());
+ assert_eq!(165, out.as_integer());
+ }
+ diff_u16 => {
+ let field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.diff(reversed);
+ assert_eq!("1010101111010101", out.as_binary());
+ assert_eq!(43989, out.as_integer());
+ }
+ diff_u32 => {
+ let field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.diff(reversed);
+ assert_eq!("11110101000100111100100010101111", out.as_binary());
+ assert_eq!(4111714479, out.as_integer());
+ }
+ diff_u64 => {
+ let field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.diff(reversed);
+ assert_eq!("0001010011000010001001001001100110011001001001000100001100101000", out.as_binary());
+ assert_eq!(1495798268358312744, out.as_integer());
+ }
+ diff_u128 => {
+ let field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.diff(reversed);
+ assert_eq!("10010001110011001000001110100101110101111000111101001010101000100100010101010010111100011110101110100101110000010011001110001001", out.as_binary());
+ assert_eq!(193799958082971305581995159990093034377, out.as_integer());
+ }
+ // diff_usize => {
+ // let field = MyFieldUsize(USIZE);
+ // }
+ }
+
+ // combine
+ tests! {
+ combine_u8 => {
+ let field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.combine(reversed);
+ assert_eq!("11111111", out.as_binary());
+ assert_eq!(255, out.as_integer());
+ }
+ combine_u16 => {
+ let field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.combine(reversed);
+ assert_eq!("1110101111010111", out.as_binary());
+ assert_eq!(60375, out.as_integer());
+ }
+ combine_u32 => {
+ let field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.combine(reversed);
+ assert_eq!("11111101100100111100100110111111", out.as_binary());
+ assert_eq!(4254321087, out.as_integer());
+ }
+ combine_u64 => {
+ let field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.combine(reversed);
+ assert_eq!("1111111011010010001111111001110110111001111111000100101101111111", out.as_binary());
+ assert_eq!(18361808577405668223, out.as_integer());
+ }
+ combine_u128 => {
+ let field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.combine(reversed);
+ assert_eq!("11111001111111011110001110100101111101111110111101101011111111111111111111010110111101111110111110100101110001111011111110011111", out.as_binary());
+ assert_eq!(332296039312012448238196841470979719071, out.as_integer());
+ }
+ // combine_usize => {
+ // let field = MyFieldUsize(USIZE);
+ // }
+ }
+
+ // intersect
+ tests! {
+ intersect_u8 => {
+ let field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.intersect(reversed);
+ assert_eq!("01011010", out.as_binary());
+ assert_eq!(90, out.as_integer());
+ }
+ intersect_u16 => {
+ let field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.intersect(reversed);
+ assert_eq!("0100000000000010", out.as_binary());
+ assert_eq!(16386, out.as_integer());
+ }
+ intersect_u32 => {
+ let field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.intersect(reversed);
+ assert_eq!("00001000100000000000000100010000", out.as_binary());
+ assert_eq!(142606608, out.as_integer());
+ }
+ intersect_u64 => {
+ let field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.intersect(reversed);
+ assert_eq!("1110101000010000000110110000010000100000110110000000100001010111", out.as_binary());
+ assert_eq!(16866010309047355479, out.as_integer());
+ }
+ intersect_u128 => {
+ let field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.intersect(reversed);
+ assert_eq!("01101000001100010110000000000000001000000110000000100001010111011011101010000100000001100000010000000000000001101000110000010110", out.as_binary());
+ assert_eq!(138496081229041142656201681480886684694, out.as_integer());
+ }
+ // intersect_usize => {
+ // let field = MyFieldUsize(USIZE);
+ // }
+ }
+
+ // into diff
+ tests! {
+ into_diff_u8 => {
+ let field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_diff(reversed);
+ assert_eq!("10100101", out.as_binary());
+ assert_eq!(165, out.as_integer());
+ }
+ into_diff_u16 => {
+ let field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_diff(reversed);
+ assert_eq!("1010101111010101", out.as_binary());
+ assert_eq!(43989, out.as_integer());
+ }
+ into_diff_u32 => {
+ let field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_diff(reversed);
+ assert_eq!("11110101000100111100100010101111", out.as_binary());
+ assert_eq!(4111714479, out.as_integer());
+ }
+ into_diff_u64 => {
+ let field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_diff(reversed);
+ assert_eq!("0001010011000010001001001001100110011001001001000100001100101000", out.as_binary());
+ assert_eq!(1495798268358312744, out.as_integer());
+ }
+ into_diff_u128 => {
+ let field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_diff(reversed);
+ assert_eq!("10010001110011001000001110100101110101111000111101001010101000100100010101010010111100011110101110100101110000010011001110001001", out.as_binary());
+ assert_eq!(193799958082971305581995159990093034377, out.as_integer());
+ }
+ // into_diff_usize => {
+ // let field = MyFieldUsize(USIZE);
+ // }
+ }
+
+ // into combined
+ tests! {
+ into_combined_u8 => {
+ let field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_combined(reversed);
+ assert_eq!("11111111", out.as_binary());
+ assert_eq!(255, out.as_integer());
+ }
+ into_combined_u16 => {
+ let field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_combined(reversed);
+ assert_eq!("1110101111010111", out.as_binary());
+ assert_eq!(60375, out.as_integer());
+ }
+ into_combined_u32 => {
+ let field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_combined(reversed);
+ assert_eq!("11111101100100111100100110111111", out.as_binary());
+ assert_eq!(4254321087, out.as_integer());
+ }
+ into_combined_u64 => {
+ let field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_combined(reversed);
+ assert_eq!("1111111011010010001111111001110110111001111111000100101101111111", out.as_binary());
+ assert_eq!(18361808577405668223, out.as_integer());
+ }
+ into_combined_u128 => {
+ let field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_combined(reversed);
+ assert_eq!("11111001111111011110001110100101111101111110111101101011111111111111111111010110111101111110111110100101110001111011111110011111", out.as_binary());
+ assert_eq!(332296039312012448238196841470979719071, out.as_integer());
+ }
+ // into_combined_usize => {
+ // let field = MyFieldUsize(USIZE);
+ // }
+ }
+
+ // into intersection
+ tests! {
+ into_intersection_u8 => {
+ let field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_intersection(reversed);
+ assert_eq!("01011010", out.as_binary());
+ assert_eq!(90, out.as_integer());
+ }
+ into_intersection_u16 => {
+ let field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_intersection(reversed);
+ assert_eq!("0100000000000010", out.as_binary());
+ assert_eq!(16386, out.as_integer());
+ }
+ into_intersection_u32 => {
+ let field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_intersection(reversed);
+ assert_eq!("00001000100000000000000100010000", out.as_binary());
+ assert_eq!(142606608, out.as_integer());
+ }
+ into_intersection_u64 => {
+ let field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_intersection(reversed);
+ assert_eq!("1110101000010000000110110000010000100000110110000000100001010111", out.as_binary());
+ assert_eq!(16866010309047355479, out.as_integer());
+ }
+ into_intersection_u128 => {
+ let field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field.into_intersection(reversed);
+ assert_eq!("01101000001100010110000000000000001000000110000000100001010111011011101010000100000001100000010000000000000001101000110000010110", out.as_binary());
+ assert_eq!(138496081229041142656201681480886684694, out.as_integer());
+ }
+ // into_intersection_usize => {
+ // let field = MyFieldUsize(USIZE);
+ // }
+ }
+
+ // field from flag
+ tests! {
+ field_from_flag_u8 => {
+ for index in 0..u8::BITS {
+ let flag = MyFlagsU8::from(index as u8);
+ let field = MyFieldU8::from(flag);
+ assert_eq!(MyFieldU8(0u8 | (1 << index)), field)
+ }
+ }
+ field_from_flag_u16 => {
+ for index in 0..u16::BITS {
+ let flag = MyFlagsU16::from(index as u8);
+ let field = MyFieldU16::from(flag);
+ assert_eq!(MyFieldU16(0u16 | (1 << index)), field)
+ }
+ }
+ field_from_flag_u32 => {
+ for index in 0..u32::BITS {
+ let flag = MyFlagsU32::from(index as u8);
+ let field = MyFieldU32::from(flag);
+ assert_eq!(MyFieldU32(0u32 | (1 << index)), field)
+ }
+ }
+ field_from_flag_u64 => {
+ for index in 0..u64::BITS {
+ let flag = MyFlagsU64::from(index as u8);
+ let field = MyFieldU64::from(flag);
+ assert_eq!(MyFieldU64(0u64 | (1 << index)), field)
+ }
+ }
+ field_from_flag_u128 => {
+ for index in 0..u128::BITS {
+ let flag = MyFlagsU128::from(index as u8);
+ let field = MyFieldU128::from(flag);
+ assert_eq!(MyFieldU128(0u128 | (1 << index)), field)
+ }
+ }
+ field_from_flag_usize => {
+ for index in 0..usize::BITS {
+ let flag = MyFlagsUsize::from(index as u8);
+ let field = MyFieldUsize::from(flag);
+ assert_eq!(MyFieldUsize(0usize | (1 << index)), field)
}
}
- bitwise_name_and_flag_u128 => {
- for index in 0..u128::BITS {
- let mask = MyFieldU128(u128::MAX) & MyFlagsU128::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
- }
- }
- // bitwise_name_and_flag_usize => {
- //
- // }
}
- // $name | $flag
- tests! {
- bitwise_name_or_flag_u8 => {
- for index in 0..u8::BITS {
- let mask = MyFieldU8(0) | MyFlagsU8::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ // $name & $name
+ tests! {
+ bitwise_name_and_name_u8 => {
+ let field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field & reversed;
+ assert_eq!("01011010", out.as_binary());
+ assert_eq!(90, out.as_integer());
+ }
+ bitwise_name_and_name_u16 => {
+ let field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field & reversed;
+ assert_eq!("0100000000000010", out.as_binary());
+ assert_eq!(16386, out.as_integer());
+ }
+ bitwise_name_and_name_u32 => {
+ let field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field & reversed;
+ assert_eq!("00001000100000000000000100010000", out.as_binary());
+ assert_eq!(142606608, out.as_integer());
+ }
+ bitwise_name_and_name_u64 => {
+ let field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field & reversed;
+ assert_eq!("1110101000010000000110110000010000100000110110000000100001010111", out.as_binary());
+ assert_eq!(16866010309047355479, out.as_integer());
+ }
+ bitwise_name_and_name_u128 => {
+ let field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field & reversed;
+ assert_eq!("01101000001100010110000000000000001000000110000000100001010111011011101010000100000001100000010000000000000001101000110000010110", out.as_binary());
+ assert_eq!(138496081229041142656201681480886684694, out.as_integer());
+ }
+ // bitwise_name_and_name_usize => {
+ //
+ // }
+ }
+
+ // $name | $name
+ tests! {
+ bitwise_name_or_name_u8 => {
+ let field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field | reversed;
+ assert_eq!("11111111", out.as_binary());
+ assert_eq!(255, out.as_integer());
+ }
+ bitwise_name_or_name_u16 => {
+ let field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field | reversed;
+ assert_eq!("1110101111010111", out.as_binary());
+ assert_eq!(60375, out.as_integer());
+ }
+ bitwise_name_or_name_u32 => {
+ let field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field | reversed;
+ assert_eq!("11111101100100111100100110111111", out.as_binary());
+ assert_eq!(4254321087, out.as_integer());
+ }
+ bitwise_name_or_name_u64 => {
+ let field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field | reversed;
+ assert_eq!("1111111011010010001111111001110110111001111111000100101101111111", out.as_binary());
+ assert_eq!(18361808577405668223, out.as_integer());
+ }
+ bitwise_name_or_name_u128 => {
+ let field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field | reversed;
+ assert_eq!("11111001111111011110001110100101111101111110111101101011111111111111111111010110111101111110111110100101110001111011111110011111", out.as_binary());
+ assert_eq!(332296039312012448238196841470979719071, out.as_integer());
+ }
+ // bitwise_name_or_name_usize => {
+ //
+ // }
+ }
+
+ // $name ^ $name
+ tests! {
+ bitwise_name_xor_name_u8 => {
+ let field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field ^ reversed;
+ assert_eq!("10100101", out.as_binary());
+ assert_eq!(165, out.as_integer());
+ }
+ bitwise_name_xor_name_u16 => {
+ let field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field ^ reversed;
+ assert_eq!("1010101111010101", out.as_binary());
+ assert_eq!(43989, out.as_integer());
+ }
+ bitwise_name_xor_name_u32 => {
+ let field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field ^ reversed;
+ assert_eq!("11110101000100111100100010101111", out.as_binary());
+ assert_eq!(4111714479, out.as_integer());
+ }
+ bitwise_name_xor_name_u64 => {
+ let field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field ^ reversed;
+ assert_eq!("0001010011000010001001001001100110011001001001000100001100101000", out.as_binary());
+ assert_eq!(1495798268358312744, out.as_integer());
+ }
+ bitwise_name_xor_name_u128 => {
+ let field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ let out = field ^ reversed;
+ assert_eq!("10010001110011001000001110100101110101111000111101001010101000100100010101010010111100011110101110100101110000010011001110001001", out.as_binary());
+ assert_eq!(193799958082971305581995159990093034377, out.as_integer());
+ }
+ // bitwise_name_xor_name_usize => {
+ //
+ // }
+ }
+
+ // $name &= $name
+ tests! {
+ bitwise_name_and_assign_name_u8 => {
+ let mut field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field &= reversed;
+ assert_eq!("01011010", field.as_binary());
+ assert_eq!(90, field.as_integer());
+ }
+ bitwise_name_and_assign_name_u16 => {
+ let mut field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field &= reversed;
+ assert_eq!("0100000000000010", field.as_binary());
+ assert_eq!(16386, field.as_integer());
+ }
+ bitwise_name_and_assign_name_u32 => {
+ let mut field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field &= reversed;
+ assert_eq!("00001000100000000000000100010000", field.as_binary());
+ assert_eq!(142606608, field.as_integer());
+ }
+ bitwise_name_and_assign_name_u64 => {
+ let mut field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field &= reversed;
+ assert_eq!("1110101000010000000110110000010000100000110110000000100001010111", field.as_binary());
+ assert_eq!(16866010309047355479, field.as_integer());
+ }
+ bitwise_name_and_assign_name_u128 => {
+ let mut field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field &= reversed;
+ assert_eq!("01101000001100010110000000000000001000000110000000100001010111011011101010000100000001100000010000000000000001101000110000010110", field.as_binary());
+ assert_eq!(138496081229041142656201681480886684694, field.as_integer());
+ }
+ // bitwise_name_and_assign_name_usize => {
+ //
+ // }
+ }
+
+ // $name |= $name
+ tests! {
+ bitwise_name_or_assign_name_u8 => {
+ let mut field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field |= reversed;
+ assert_eq!("11111111", field.as_binary());
+ assert_eq!(255, field.as_integer());
+ }
+ bitwise_name_or_assign_name_u16 => {
+ let mut field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field |= reversed;
+ assert_eq!("1110101111010111", field.as_binary());
+ assert_eq!(60375, field.as_integer());
+ }
+ bitwise_name_or_assign_name_u32 => {
+ let mut field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field |= reversed;
+ assert_eq!("11111101100100111100100110111111", field.as_binary());
+ assert_eq!(4254321087, field.as_integer());
+ }
+ bitwise_name_or_assign_name_u64 => {
+ let mut field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field |= reversed;
+ assert_eq!("1111111011010010001111111001110110111001111111000100101101111111", field.as_binary());
+ assert_eq!(18361808577405668223, field.as_integer());
+ }
+ bitwise_name_or_assign_name_u128 => {
+ let mut field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field |= reversed;
+ assert_eq!("11111001111111011110001110100101111101111110111101101011111111111111111111010110111101111110111110100101110001111011111110011111", field.as_binary());
+ assert_eq!(332296039312012448238196841470979719071, field.as_integer());
+ }
+ // bitwise_name_or_assign_name_usize => {
+ //
+ // }
+ }
+
+ // $name ^= $name
+ tests! {
+ bitwise_name_xor_assign_name_u8 => {
+ let mut field = MyFieldU8(U8);
+ let reversed = MyFieldU8(u8::from_str_radix(B8.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field ^= reversed;
+ assert_eq!("10100101", field.as_binary());
+ assert_eq!(165, field.as_integer());
+ }
+ bitwise_name_xor_assign_name_u16 => {
+ let mut field = MyFieldU16(U16);
+ let reversed = MyFieldU16(u16::from_str_radix(B16.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field ^= reversed;
+ assert_eq!("1010101111010101", field.as_binary());
+ assert_eq!(43989, field.as_integer());
+ }
+ bitwise_name_xor_assign_name_u32 => {
+ let mut field = MyFieldU32(U32);
+ let reversed = MyFieldU32(u32::from_str_radix(B32.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field ^= reversed;
+ assert_eq!("11110101000100111100100010101111", field.as_binary());
+ assert_eq!(4111714479, field.as_integer());
+ }
+ bitwise_name_xor_assign_name_u64 => {
+ let mut field = MyFieldU64(U64);
+ let reversed = MyFieldU64(u64::from_str_radix(B64.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field ^= reversed;
+ assert_eq!("0001010011000010001001001001100110011001001001000100001100101000", field.as_binary());
+ assert_eq!(1495798268358312744, field.as_integer());
+ }
+ bitwise_name_xor_assign_name_u128 => {
+ let mut field = MyFieldU128(U128);
+ let reversed = MyFieldU128(u128::from_str_radix(B128.chars().rev().collect::<String>().as_str(), 2).unwrap());
+ field ^= reversed;
+ assert_eq!("10010001110011001000001110100101110101111000111101001010101000100100010101010010111100011110101110100101110000010011001110001001", field.as_binary());
+ assert_eq!(193799958082971305581995159990093034377, field.as_integer());
+ }
+ // bitwise_name_xor_assign_name_usize => {
+ //
+ // }
+ }
+
+ // $name & $flag
+ tests! {
+ bitwise_name_and_flag_u8 => {
+ for index in 0..u8::BITS {
+ let mask = MyFieldU8(u8::MAX) & MyFlagsU8::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ }
+ }
+ bitwise_name_and_flag_u16 => {
+ for index in 0..u16::BITS {
+ let mask = MyFieldU16(u16::MAX) & MyFlagsU16::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ }
+ }
+ bitwise_name_and_flag_u32 => {
+ for index in 0..u32::BITS {
+ let mask = MyFieldU32(u32::MAX) & MyFlagsU32::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ }
+ }
+ bitwise_name_and_flag_u64 => {
+ for index in 0..u64::BITS {
+ let mask = MyFieldU64(u64::MAX) & MyFlagsU64::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ }
+ }
+ bitwise_name_and_flag_u128 => {
+ for index in 0..u128::BITS {
+ let mask = MyFieldU128(u128::MAX) & MyFlagsU128::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ }
+ }
+ // bitwise_name_and_flag_usize => {
+ //
+ // }
+ }
+
+ // $name | $flag
+ tests! {
+ bitwise_name_or_flag_u8 => {
+ for index in 0..u8::BITS {
+ let mask = MyFieldU8(0) | MyFlagsU8::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_or_flag_u16 => {
- for index in 0..u16::BITS {
- let mask = MyFieldU16(0) | MyFlagsU16::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_or_flag_u16 => {
+ for index in 0..u16::BITS {
+ let mask = MyFieldU16(0) | MyFlagsU16::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_or_flag_u32 => {
- for index in 0..u32::BITS {
- let mask = MyFieldU32(0) | MyFlagsU32::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_or_flag_u32 => {
+ for index in 0..u32::BITS {
+ let mask = MyFieldU32(0) | MyFlagsU32::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_or_flag_u64 => {
- for index in 0..u64::BITS {
- let mask = MyFieldU64(0) | MyFlagsU64::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_or_flag_u64 => {
+ for index in 0..u64::BITS {
+ let mask = MyFieldU64(0) | MyFlagsU64::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_or_flag_u128 => {
- for index in 0..u128::BITS {
- let mask = MyFieldU128(0) | MyFlagsU128::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_or_flag_u128 => {
+ for index in 0..u128::BITS {
+ let mask = MyFieldU128(0) | MyFlagsU128::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- // bitwise_name_or_flag_usize => {
- //
- // }
- }
+ // bitwise_name_or_flag_usize => {
+ //
+ // }
+ }
- // $name ^ $flag
- tests! {
- bitwise_name_xor_flag_u8 => {
- for index in 0..u8::BITS {
- let mask = MyFieldU8(0) ^ MyFlagsU8::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ // $name ^ $flag
+ tests! {
+ bitwise_name_xor_flag_u8 => {
+ for index in 0..u8::BITS {
+ let mask = MyFieldU8(0) ^ MyFlagsU8::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_xor_flag_u16 => {
- for index in 0..u16::BITS {
- let mask = MyFieldU16(0) ^ MyFlagsU16::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_xor_flag_u16 => {
+ for index in 0..u16::BITS {
+ let mask = MyFieldU16(0) ^ MyFlagsU16::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_xor_flag_u32 => {
- for index in 0..u32::BITS {
- let mask = MyFieldU32(0) ^ MyFlagsU32::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_xor_flag_u32 => {
+ for index in 0..u32::BITS {
+ let mask = MyFieldU32(0) ^ MyFlagsU32::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_xor_flag_u64 => {
- for index in 0..u64::BITS {
- let mask = MyFieldU64(0) ^ MyFlagsU64::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_xor_flag_u64 => {
+ for index in 0..u64::BITS {
+ let mask = MyFieldU64(0) ^ MyFlagsU64::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_xor_flag_u128 => {
- for index in 0..u128::BITS {
- let mask = MyFieldU128(0) ^ MyFlagsU128::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_xor_flag_u128 => {
+ for index in 0..u128::BITS {
+ let mask = MyFieldU128(0) ^ MyFlagsU128::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- // bitwise_name_xor_flag_usize => {
- //
- // }
- }
+ // bitwise_name_xor_flag_usize => {
+ //
+ // }
+ }
- // $name &= $flag
- tests! {
- bitwise_name_and_assign_flag_u8 => {
- for index in 0..u8::BITS {
- let mut mask = MyFieldU8(u8::MAX);
- mask &= MyFlagsU8::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ // $name &= $flag
+ tests! {
+ bitwise_name_and_assign_flag_u8 => {
+ for index in 0..u8::BITS {
+ let mut mask = MyFieldU8(u8::MAX);
+ mask &= MyFlagsU8::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_and_assign_flag_u16 => {
- for index in 0..u16::BITS {
- let mut mask = MyFieldU16(u16::MAX);
- mask &= MyFlagsU16::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ bitwise_name_and_assign_flag_u16 => {
+ for index in 0..u16::BITS {
+ let mut mask = MyFieldU16(u16::MAX);
+ mask &= MyFlagsU16::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_and_assign_flag_u32 => {
- for index in 0..u32::BITS {
- let mut mask = MyFieldU32(u32::MAX);
- mask &= MyFlagsU32::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ bitwise_name_and_assign_flag_u32 => {
+ for index in 0..u32::BITS {
+ let mut mask = MyFieldU32(u32::MAX);
+ mask &= MyFlagsU32::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_and_assign_flag_u64 => {
- for index in 0..u64::BITS {
- let mut mask = MyFieldU64(u64::MAX);
- mask &= MyFlagsU64::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ bitwise_name_and_assign_flag_u64 => {
+ for index in 0..u64::BITS {
+ let mut mask = MyFieldU64(u64::MAX);
+ mask &= MyFlagsU64::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_and_assign_flag_u128 => {
- for index in 0..u128::BITS {
- let mut mask = MyFieldU128(u128::MAX);
- mask &= MyFlagsU128::from(index as u8);
- assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
+ bitwise_name_and_assign_flag_u128 => {
+ for index in 0..u128::BITS {
+ let mut mask = MyFieldU128(u128::MAX);
+ mask &= MyFlagsU128::from(index as u8);
+ assert_eq!(0 | !(1 << (index as u8) ), mask.as_integer());
}
}
- // bitwise_name_and_assign_flag_usize => {
- //
- // }
- }
+ // bitwise_name_and_assign_flag_usize => {
+ //
+ // }
+ }
- // $name |= $flag
- tests! {
- bitwise_name_or_assign_flag_u8 => {
- for index in 0..u8::BITS {
- let mut mask = MyFieldU8(0);
- mask |= MyFlagsU8::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ // $name |= $flag
+ tests! {
+ bitwise_name_or_assign_flag_u8 => {
+ for index in 0..u8::BITS {
+ let mut mask = MyFieldU8(0);
+ mask |= MyFlagsU8::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_or_assign_flag_u16 => {
- for index in 0..u16::BITS {
- let mut mask = MyFieldU16(0);
- mask |= MyFlagsU16::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_or_assign_flag_u16 => {
+ for index in 0..u16::BITS {
+ let mut mask = MyFieldU16(0);
+ mask |= MyFlagsU16::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_or_assign_flag_u32 => {
- for index in 0..u32::BITS {
- let mut mask = MyFieldU32(0);
- mask |= MyFlagsU32::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_or_assign_flag_u32 => {
+ for index in 0..u32::BITS {
+ let mut mask = MyFieldU32(0);
+ mask |= MyFlagsU32::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_or_assign_flag_u64 => {
- for index in 0..u64::BITS {
- let mut mask = MyFieldU64(0);
- mask |= MyFlagsU64::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_or_assign_flag_u64 => {
+ for index in 0..u64::BITS {
+ let mut mask = MyFieldU64(0);
+ mask |= MyFlagsU64::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_or_assign_flag_u128 => {
- for index in 0..u128::BITS {
- let mut mask = MyFieldU128(0);
- mask |= MyFlagsU128::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_or_assign_flag_u128 => {
+ for index in 0..u128::BITS {
+ let mut mask = MyFieldU128(0);
+ mask |= MyFlagsU128::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- // bitwise_name_or_assign_flag_usize => {
- //
- // }
- }
+ // bitwise_name_or_assign_flag_usize => {
+ //
+ // }
+ }
- // $name ^= $flag
- tests! {
- bitwise_name_xor_assign_flag_u8 => {
- for index in 0..u8::BITS {
- let mut mask = MyFieldU8(0);
- mask ^= MyFlagsU8::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ // $name ^= $flag
+ tests! {
+ bitwise_name_xor_assign_flag_u8 => {
+ for index in 0..u8::BITS {
+ let mut mask = MyFieldU8(0);
+ mask ^= MyFlagsU8::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_xor_assign_flag_u16 => {
- for index in 0..u16::BITS {
- let mut mask = MyFieldU16(0);
- mask ^= MyFlagsU16::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_xor_assign_flag_u16 => {
+ for index in 0..u16::BITS {
+ let mut mask = MyFieldU16(0);
+ mask ^= MyFlagsU16::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_xor_assign_flag_u32 => {
- for index in 0..u32::BITS {
- let mut mask = MyFieldU32(0);
- mask ^= MyFlagsU32::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_xor_assign_flag_u32 => {
+ for index in 0..u32::BITS {
+ let mut mask = MyFieldU32(0);
+ mask ^= MyFlagsU32::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_xor_assign_flag_u64 => {
- for index in 0..u64::BITS {
- let mut mask = MyFieldU64(0);
- mask ^= MyFlagsU64::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_xor_assign_flag_u64 => {
+ for index in 0..u64::BITS {
+ let mut mask = MyFieldU64(0);
+ mask ^= MyFlagsU64::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- bitwise_name_xor_assign_flag_u128 => {
- for index in 0..u128::BITS {
- let mut mask = MyFieldU128(0);
- mask ^= MyFlagsU128::from(index as u8);
- assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
+ bitwise_name_xor_assign_flag_u128 => {
+ for index in 0..u128::BITS {
+ let mut mask = MyFieldU128(0);
+ mask ^= MyFlagsU128::from(index as u8);
+ assert_eq!(0 | (1 << (index as u8) ), mask.as_integer());
}
}
- // bitwise_name_xor_assign_flag_usize => {
- //
- // }
- }
+ // bitwise_name_xor_assign_flag_usize => {
+ //
+ // }
+ }
- // $flag & $flag
- tests! {
- bitwise_flag_and_flag_u8 => {
- for index_a in 0..u8::BITS {
- let a = MyFlagsU8::from(index_a as u8);
- for index_b in 0..u8::BITS {
- let b = MyFlagsU8::from(index_b as u8);
- assert_eq!(MyFieldU8(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
+ // $flag & $flag
+ tests! {
+ bitwise_flag_and_flag_u8 => {
+ for index_a in 0..u8::BITS {
+ let a = MyFlagsU8::from(index_a as u8);
+ for index_b in 0..u8::BITS {
+ let b = MyFlagsU8::from(index_b as u8);
+ assert_eq!(MyFieldU8(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
}
}
}
- bitwise_flag_and_flag_u16 => {
- for index_a in 0..u16::BITS {
- let a = MyFlagsU16::from(index_a as u8);
- for index_b in 0..u16::BITS {
- let b = MyFlagsU16::from(index_b as u8);
- assert_eq!(MyFieldU16(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
+ bitwise_flag_and_flag_u16 => {
+ for index_a in 0..u16::BITS {
+ let a = MyFlagsU16::from(index_a as u8);
+ for index_b in 0..u16::BITS {
+ let b = MyFlagsU16::from(index_b as u8);
+ assert_eq!(MyFieldU16(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
}
}
}
- bitwise_flag_and_flag_u32 => {
- for index_a in 0..u32::BITS {
- let a = MyFlagsU32::from(index_a as u8);
- for index_b in 0..u32::BITS {
- let b = MyFlagsU32::from(index_b as u8);
- assert_eq!(MyFieldU32(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
+ bitwise_flag_and_flag_u32 => {
+ for index_a in 0..u32::BITS {
+ let a = MyFlagsU32::from(index_a as u8);
+ for index_b in 0..u32::BITS {
+ let b = MyFlagsU32::from(index_b as u8);
+ assert_eq!(MyFieldU32(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
}
}
}
- bitwise_flag_and_flag_u64 => {
- for index_a in 0..u64::BITS {
- let a = MyFlagsU64::from(index_a as u8);
- for index_b in 0..u64::BITS {
- let b = MyFlagsU64::from(index_b as u8);
- assert_eq!(MyFieldU64(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
+ bitwise_flag_and_flag_u64 => {
+ for index_a in 0..u64::BITS {
+ let a = MyFlagsU64::from(index_a as u8);
+ for index_b in 0..u64::BITS {
+ let b = MyFlagsU64::from(index_b as u8);
+ assert_eq!(MyFieldU64(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
}
}
}
- bitwise_flag_and_flag_u128 => {
- for index_a in 0..u128::BITS {
- let a = MyFlagsU128::from(index_a as u8);
- for index_b in 0..u128::BITS {
- let b = MyFlagsU128::from(index_b as u8);
- assert_eq!(MyFieldU128(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
+ bitwise_flag_and_flag_u128 => {
+ for index_a in 0..u128::BITS {
+ let a = MyFlagsU128::from(index_a as u8);
+ for index_b in 0..u128::BITS {
+ let b = MyFlagsU128::from(index_b as u8);
+ assert_eq!(MyFieldU128(0 & 1 << index_a as u8 & 1 << index_b as u8), a & b);
}
}
}
- // bitwise_flag_and_flag_usize => {
- //
- // }
- }
+ // bitwise_flag_and_flag_usize => {
+ //
+ // }
+ }
- // $flag | $flag
- tests! {
- bitwise_flag_or_flag_u8 => {
- for index_a in 0..u8::BITS {
- let a = MyFlagsU8::from(index_a as u8);
- for index_b in 0..u8::BITS {
- let b = MyFlagsU8::from(index_b as u8);
- assert_eq!(MyFieldU8(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
+ // $flag | $flag
+ tests! {
+ bitwise_flag_or_flag_u8 => {
+ for index_a in 0..u8::BITS {
+ let a = MyFlagsU8::from(index_a as u8);
+ for index_b in 0..u8::BITS {
+ let b = MyFlagsU8::from(index_b as u8);
+ assert_eq!(MyFieldU8(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
}
}
}
- bitwise_flag_or_flag_u16 => {
- for index_a in 0..u16::BITS {
- let a = MyFlagsU16::from(index_a as u8);
- for index_b in 0..u16::BITS {
- let b = MyFlagsU16::from(index_b as u8);
- assert_eq!(MyFieldU16(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
+ bitwise_flag_or_flag_u16 => {
+ for index_a in 0..u16::BITS {
+ let a = MyFlagsU16::from(index_a as u8);
+ for index_b in 0..u16::BITS {
+ let b = MyFlagsU16::from(index_b as u8);
+ assert_eq!(MyFieldU16(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
}
}
}
- bitwise_flag_or_flag_u32 => {
- for index_a in 0..u32::BITS {
- let a = MyFlagsU32::from(index_a as u8);
- for index_b in 0..u32::BITS {
- let b = MyFlagsU32::from(index_b as u8);
- assert_eq!(MyFieldU32(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
+ bitwise_flag_or_flag_u32 => {
+ for index_a in 0..u32::BITS {
+ let a = MyFlagsU32::from(index_a as u8);
+ for index_b in 0..u32::BITS {
+ let b = MyFlagsU32::from(index_b as u8);
+ assert_eq!(MyFieldU32(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
}
}
}
- bitwise_flag_or_flag_u64 => {
- for index_a in 0..u64::BITS {
- let a = MyFlagsU64::from(index_a as u8);
- for index_b in 0..u64::BITS {
- let b = MyFlagsU64::from(index_b as u8);
- assert_eq!(MyFieldU64(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
+ bitwise_flag_or_flag_u64 => {
+ for index_a in 0..u64::BITS {
+ let a = MyFlagsU64::from(index_a as u8);
+ for index_b in 0..u64::BITS {
+ let b = MyFlagsU64::from(index_b as u8);
+ assert_eq!(MyFieldU64(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
}
}
}
- bitwise_flag_or_flag_u128 => {
- for index_a in 0..u128::BITS {
- let a = MyFlagsU128::from(index_a as u8);
- for index_b in 0..u128::BITS {
- let b = MyFlagsU128::from(index_b as u8);
- assert_eq!(MyFieldU128(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
+ bitwise_flag_or_flag_u128 => {
+ for index_a in 0..u128::BITS {
+ let a = MyFlagsU128::from(index_a as u8);
+ for index_b in 0..u128::BITS {
+ let b = MyFlagsU128::from(index_b as u8);
+ assert_eq!(MyFieldU128(0 | 1 << index_a as u8 | 1 << index_b as u8), a | b);
}
}
}
- // bitwise_flag_or_flag_usize => {
- //
- // }
- }
+ // bitwise_flag_or_flag_usize => {
+ //
+ // }
+ }
- // $flag ^ $flag
- tests! {
- bitwise_flag_xor_flag_u8 => {
- for index_a in 0..u8::BITS {
- let a = MyFlagsU8::from(index_a as u8);
- for index_b in 0..u8::BITS {
- let b = MyFlagsU8::from(index_b as u8);
- assert_eq!(MyFieldU8(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
+ // $flag ^ $flag
+ tests! {
+ bitwise_flag_xor_flag_u8 => {
+ for index_a in 0..u8::BITS {
+ let a = MyFlagsU8::from(index_a as u8);
+ for index_b in 0..u8::BITS {
+ let b = MyFlagsU8::from(index_b as u8);
+ assert_eq!(MyFieldU8(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
}
}
}
- bitwise_flag_xor_flag_u16 => {
- for index_a in 0..u16::BITS {
- let a = MyFlagsU16::from(index_a as u8);
- for index_b in 0..u16::BITS {
- let b = MyFlagsU16::from(index_b as u8);
- assert_eq!(MyFieldU16(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
+ bitwise_flag_xor_flag_u16 => {
+ for index_a in 0..u16::BITS {
+ let a = MyFlagsU16::from(index_a as u8);
+ for index_b in 0..u16::BITS {
+ let b = MyFlagsU16::from(index_b as u8);
+ assert_eq!(MyFieldU16(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
}
}
}
- bitwise_flag_xor_flag_u32 => {
- for index_a in 0..u32::BITS {
- let a = MyFlagsU32::from(index_a as u8);
- for index_b in 0..u32::BITS {
- let b = MyFlagsU32::from(index_b as u8);
- assert_eq!(MyFieldU32(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
+ bitwise_flag_xor_flag_u32 => {
+ for index_a in 0..u32::BITS {
+ let a = MyFlagsU32::from(index_a as u8);
+ for index_b in 0..u32::BITS {
+ let b = MyFlagsU32::from(index_b as u8);
+ assert_eq!(MyFieldU32(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
}
}
}
- bitwise_flag_xor_flag_u64 => {
- for index_a in 0..u64::BITS {
- let a = MyFlagsU64::from(index_a as u8);
- for index_b in 0..u64::BITS {
- let b = MyFlagsU64::from(index_b as u8);
- assert_eq!(MyFieldU64(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
+ bitwise_flag_xor_flag_u64 => {
+ for index_a in 0..u64::BITS {
+ let a = MyFlagsU64::from(index_a as u8);
+ for index_b in 0..u64::BITS {
+ let b = MyFlagsU64::from(index_b as u8);
+ assert_eq!(MyFieldU64(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
}
}
}
- bitwise_flag_xor_flag_u128 => {
- for index_a in 0..u128::BITS {
- let a = MyFlagsU128::from(index_a as u8);
- for index_b in 0..u128::BITS {
- let b = MyFlagsU128::from(index_b as u8);
- assert_eq!(MyFieldU128(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
+ bitwise_flag_xor_flag_u128 => {
+ for index_a in 0..u128::BITS {
+ let a = MyFlagsU128::from(index_a as u8);
+ for index_b in 0..u128::BITS {
+ let b = MyFlagsU128::from(index_b as u8);
+ assert_eq!(MyFieldU128(0 ^ 1 << index_a as u8 ^ 1 << index_b as u8), a ^ b);
}
}
}
- // bitwise_flag_xor_flag_usize => {
- //
- // }
- }
+ // bitwise_flag_xor_flag_usize => {
+ //
+ // }
+ }
- // flag from u8
- tests! {
- flag_from_u8_u8 => {
- for index in 0..u8::BITS {
- let _ = MyFlagsU8::from(index as u8);
+ // flag from u8
+ tests! {
+ flag_from_u8_u8 => {
+ for index in 0..u8::BITS {
+ let _ = MyFlagsU8::from(index as u8);
}
}
- flag_from_u8_u16 => {
- for index in 0..u16::BITS {
- let _ = MyFlagsU16::from(index as u8);
+ flag_from_u8_u16 => {
+ for index in 0..u16::BITS {
+ let _ = MyFlagsU16::from(index as u8);
}
}
- flag_from_u8_u32 => {
- for index in 0..u32::BITS {
- let _ = MyFlagsU32::from(index as u8);
+ flag_from_u8_u32 => {
+ for index in 0..u32::BITS {
+ let _ = MyFlagsU32::from(index as u8);
}
}
- flag_from_u8_u64 => {
- for index in 0..u64::BITS {
- let _ = MyFlagsU64::from(index as u8);
+ flag_from_u8_u64 => {
+ for index in 0..u64::BITS {
+ let _ = MyFlagsU64::from(index as u8);
}
}
- flag_from_u8_u128 => {
- for index in 0..u128::BITS {
- let _ = MyFlagsU128::from(index as u8);
+ flag_from_u8_u128 => {
+ for index in 0..u128::BITS {
+ let _ = MyFlagsU128::from(index as u8);
}
}
- flag_from_u8_usize => {
- for index in 0..usize::BITS {
- let _ = MyFlagsUsize::from(index as u8);
+ flag_from_u8_usize => {
+ for index in 0..usize::BITS {
+ let _ = MyFlagsUsize::from(index as u8);
}
}
}
- // u8 from flag
- tests! {
- u8_from_flag_u8 => {
- for index in 0..u8::BITS {
- assert_eq!(MyFlagsU8::from(index as u8) as u8, index as u8)
+ // u8 from flag
+ tests! {
+ u8_from_flag_u8 => {
+ for index in 0..u8::BITS {
+ assert_eq!(MyFlagsU8::from(index as u8) as u8, index as u8)
}
}
- u8_from_flag_u16 => {
- for index in 0..u16::BITS {
- assert_eq!(MyFlagsU16::from(index as u8) as u8, index as u8)
+ u8_from_flag_u16 => {
+ for index in 0..u16::BITS {
+ assert_eq!(MyFlagsU16::from(index as u8) as u8, index as u8)
}
}
- u8_from_flag_u32 => {
- for index in 0..u32::BITS {
- assert_eq!(MyFlagsU32::from(index as u8) as u8, index as u8)
+ u8_from_flag_u32 => {
+ for index in 0..u32::BITS {
+ assert_eq!(MyFlagsU32::from(index as u8) as u8, index as u8)
}
}
- u8_from_flag_u64 => {
- for index in 0..u64::BITS {
- assert_eq!(MyFlagsU64::from(index as u8) as u8, index as u8)
+ u8_from_flag_u64 => {
+ for index in 0..u64::BITS {
+ assert_eq!(MyFlagsU64::from(index as u8) as u8, index as u8)
}
}
- u8_from_flag_u128 => {
- for index in 0..u128::BITS {
- assert_eq!(MyFlagsU128::from(index as u8) as u8, index as u8)
+ u8_from_flag_u128 => {
+ for index in 0..u128::BITS {
+ assert_eq!(MyFlagsU128::from(index as u8) as u8, index as u8)
}
}
- u8_from_flag_usize => {
- for index in 0..usize::BITS {
- assert_eq!(MyFlagsUsize::from(index as u8) as u8, index as u8)
+ u8_from_flag_usize => {
+ for index in 0..usize::BITS {
+ assert_eq!(MyFlagsUsize::from(index as u8) as u8, index as u8)
}
}
}
}
-// -------------------------------------------------------------------------------------------------
-
-fn:) to \
+ restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \
+ enum, trait, type, macro, \
+ and const.","Search functions by type signature (e.g., vec -> usize or \
+ -> vec or String, enum:Cow -> bool)","You can look for items with an exact name by putting double quotes around \
+ your request: \"string\"","Look for functions that accept or return \
+ slices and \
+ arrays by writing \
+ square brackets (e.g., -> [u8] or [] -> Option)","Look for items inside another one by searching for a path: vec::Vec",].map(x=>""+x+"
").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="${value.replaceAll(" ", " ")}`}else{error[index]=value}});output+=`Example of generated output, using only a bit field without a flag enum.
+Example of generated output, using only a bit field without a flag enum.
This module is only compiled with documentation builds and will not be available for import.
-use the bitfield macro to generate a field struct and flag enum.
Optional docstring for my example bit field.
-use the bitfield macro to generate a field struct and flag enum.
pub struct ExampleField(_);Optional docstring for my example bit field.
-Constant values describing ExampleField.
Number of bits in an instance of ExampleField.
Number of bytes used by an instance of ExampleField.
Maximum valid integer for ExampleField.
Constructors for creating instances of ExampleField.
Create a new instance of ExampleField from a u8 value.
Create a new instance of ExampleField from 0.
Create a new instance of ExampleField from the maximum possible integer value.
Create a new instance of ExampleField from a binary string.
Create a new instance of ExampleField from a binary string.
Current state of this bitfield.
-Field accessors by index for ExampleField.
Returns the value of the bit at the supplied index as a boolean.
-Sets the value of the bit at the supplied index to 0.
Flips the value of the bit at the supplied index.
-Combinators for ExampleField.
Returns a new ExampleFieldwith ones for flags that do not match. Does not consume self.
Returns a new ExampleFieldwith ones for flags that were set on either input. Does not consume self.
Returns a new ExampleFieldwith ones for flags that were set on both inputs. Does not consume self.
Conversion methods.
-Returns a new ExampleFieldwith ones for flags that do not match. Consumes self.
Returns a new ExampleFieldwith ones for flags that were set on either input. Consumes self.
Returns a new ExampleFieldwith ones for flags that were set on both inputs. Consumes self.
Performs the &= operation. Read more
Performs the |= operation. Read more
Performs the ^= operation. Read more
Returns a copy of the value. Read more
-Performs copy-assignment from source. Read more
Returns a field instance from value of its underlying type.
-Performs the conversion.
-This method tests for self and other values to be equal, and is used
-by ==. Read more
This method tests for !=.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
-operator. Read more
Mutably borrows from an owned value. Read more
-Calls U::from(self).
pub struct ExampleField(_);Optional docstring for my example bit field.
+Constant values describing ExampleField.
Number of bits in an instance of ExampleField.
Number of bytes used by an instance of ExampleField.
Maximum valid integer for ExampleField.
Constructors for creating instances of ExampleField.
Create a new instance of ExampleField from a u8 value.
Create a new instance of ExampleField from 0.
Create a new instance of ExampleField from the maximum possible integer value.
Create a new instance of ExampleField from a binary string.
Create a new instance of ExampleField from a binary string.
Current state of this bitfield.
+Field accessors by index for ExampleField.
Returns the value of the bit at the supplied index as a boolean.
+Sets the value of the bit at the supplied index to 0.
Flips the value of the bit at the supplied index.
+Combinators for ExampleField.
Returns a new ExampleFieldwith ones for flags that do not match. Does not consume self.
Returns a new ExampleFieldwith ones for flags that were set on either input. Does not consume self.
Returns a new ExampleFieldwith ones for flags that were set on both inputs. Does not consume self.
Conversion methods.
+Returns a new ExampleFieldwith ones for flags that do not match. Consumes self.
Returns a new ExampleFieldwith ones for flags that were set on either input. Consumes self.
Returns a new ExampleFieldwith ones for flags that were set on both inputs. Consumes self.
&= operation. Read more|= operation. Read more^= operation. Read moresource. Read moreReturns a field instance from value of its underlying type.
+self and other values to be equal, and is used
+by ==.self and other) and is used by the <=
+operator. Read moreThe resulting type after obtaining ownership.
-Creates owned data from borrowed data, usually by cloning. Read more
-toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
-From<T> for U chooses to do.
+#[repr(u8)]
-pub enum ExampleFlags {
+ExampleFlags in ubits::examples::full_example - Rust Enum ubits::examples::full_example::ExampleFlags
source · #[repr(u8)]pub enum ExampleFlags {
Flag0,
Flag1,
Flag2,
@@ -14,78 +7,35 @@ Enum ubits:
Flag5,
Flag6,
Flag7,
-}
Expand description
Optional docstring for my flag enum.
-Variants
Flag0
Optional docstring for Flag0
-Flag1
Optional docstring for Flag1
-Flag2
Optional docstring for Flag2
-Flag3
Optional docstring for Flag3
-Flag4
Optional docstring for Flag4
-Flag5
Optional docstring for Flag5
-Flag6
Optional docstring for Flag6
-Flag7
Optional docstring for Flag7
-Trait Implementations
sourceimpl BitAnd<ExampleFlags> for ExampleFlags
sourceimpl BitAnd<ExampleFlags> for ExampleField
type Output = ExampleField
The resulting type after applying the & operator.
-sourcefn bitand(self, rhs: ExampleFlags) -> Self::Output
Performs the & operation. Read more
-sourceimpl BitAnd<ExampleFlags> for &ExampleField
type Output = ExampleField
The resulting type after applying the & operator.
-sourcefn bitand(self, rhs: ExampleFlags) -> Self::Output
Performs the & operation. Read more
-sourceimpl BitAnd<ExampleFlags> for &mut ExampleField
type Output = ExampleField
The resulting type after applying the & operator.
-sourcefn bitand(self, rhs: ExampleFlags) -> Self::Output
Performs the & operation. Read more
-sourceimpl BitAndAssign<ExampleFlags> for ExampleField
sourcefn bitand_assign(&mut self, rhs: ExampleFlags)
Performs the &= operation. Read more
-sourceimpl BitOr<ExampleFlags> for ExampleFlags
sourceimpl BitOr<ExampleFlags> for ExampleField
type Output = ExampleField
The resulting type after applying the | operator.
-sourcefn bitor(self, rhs: ExampleFlags) -> Self::Output
Performs the | operation. Read more
-sourceimpl BitOr<ExampleFlags> for &ExampleField
type Output = ExampleField
The resulting type after applying the | operator.
-sourcefn bitor(self, rhs: ExampleFlags) -> Self::Output
Performs the | operation. Read more
-sourceimpl BitOr<ExampleFlags> for &mut ExampleField
type Output = ExampleField
The resulting type after applying the | operator.
-sourcefn bitor(self, rhs: ExampleFlags) -> Self::Output
Performs the | operation. Read more
-sourceimpl BitOrAssign<ExampleFlags> for ExampleField
sourcefn bitor_assign(&mut self, rhs: ExampleFlags)
Performs the |= operation. Read more
-sourceimpl BitXor<ExampleFlags> for ExampleFlags
sourceimpl BitXor<ExampleFlags> for ExampleField
type Output = ExampleField
The resulting type after applying the ^ operator.
-sourcefn bitxor(self, rhs: ExampleFlags) -> Self::Output
Performs the ^ operation. Read more
-sourceimpl BitXor<ExampleFlags> for &ExampleField
type Output = ExampleField
The resulting type after applying the ^ operator.
-sourcefn bitxor(self, rhs: ExampleFlags) -> Self::Output
Performs the ^ operation. Read more
-sourceimpl BitXor<ExampleFlags> for &mut ExampleField
type Output = ExampleField
The resulting type after applying the ^ operator.
-sourcefn bitxor(self, rhs: ExampleFlags) -> Self::Output
Performs the ^ operation. Read more
-sourceimpl BitXorAssign<ExampleFlags> for ExampleField
sourcefn bitxor_assign(&mut self, rhs: ExampleFlags)
Performs the ^= operation. Read more
-sourceimpl Clone for ExampleFlags
sourcefn clone(&self) -> ExampleFlags
Returns a copy of the value. Read more
-1.0.0 · sourcefn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
-sourceimpl Debug for ExampleFlags
sourceimpl From<ExampleFlags> for u8
Returns a flag as its corresponding u8 value.
-sourcefn from(value: ExampleFlags) -> u8
Performs the conversion.
-sourceimpl From<ExampleFlags> for ExampleField
Returns a field instance from a flag.
-sourcefn from(value: ExampleFlags) -> ExampleField
Performs the conversion.
-sourceimpl From<u8> for ExampleFlags
Converts a u8 to a flag
+}Expand description
Optional docstring for my flag enum.
+Variants§
§Flag0
Optional docstring for Flag0
+§Flag1
Optional docstring for Flag1
+§Flag2
Optional docstring for Flag2
+§Flag3
Optional docstring for Flag3
+§Flag4
Optional docstring for Flag4
+§Flag5
Optional docstring for Flag5
+§Flag6
Optional docstring for Flag6
+§Flag7
Optional docstring for Flag7
+Trait Implementations§
source§impl BitAnd<ExampleFlags> for &ExampleField
§type Output = ExampleField
The resulting type after applying the & operator.source§impl BitAnd<ExampleFlags> for &mut ExampleField
§type Output = ExampleField
The resulting type after applying the & operator.source§impl BitAnd<ExampleFlags> for ExampleField
§type Output = ExampleField
The resulting type after applying the & operator.source§impl BitAnd<ExampleFlags> for ExampleFlags
source§impl BitAndAssign<ExampleFlags> for ExampleField
source§fn bitand_assign(&mut self, rhs: ExampleFlags)
Performs the &= operation. Read moresource§impl BitOr<ExampleFlags> for &ExampleField
§type Output = ExampleField
The resulting type after applying the | operator.source§impl BitOr<ExampleFlags> for &mut ExampleField
§type Output = ExampleField
The resulting type after applying the | operator.source§impl BitOr<ExampleFlags> for ExampleField
§type Output = ExampleField
The resulting type after applying the | operator.source§impl BitOr<ExampleFlags> for ExampleFlags
source§impl BitOrAssign<ExampleFlags> for ExampleField
source§fn bitor_assign(&mut self, rhs: ExampleFlags)
Performs the |= operation. Read moresource§impl BitXor<ExampleFlags> for &ExampleField
§type Output = ExampleField
The resulting type after applying the ^ operator.source§impl BitXor<ExampleFlags> for &mut ExampleField
§type Output = ExampleField
The resulting type after applying the ^ operator.source§impl BitXor<ExampleFlags> for ExampleField
§type Output = ExampleField
The resulting type after applying the ^ operator.source§impl BitXor<ExampleFlags> for ExampleFlags
source§impl BitXorAssign<ExampleFlags> for ExampleField
source§fn bitxor_assign(&mut self, rhs: ExampleFlags)
Performs the ^= operation. Read moresource§impl Clone for ExampleFlags
source§fn clone(&self) -> ExampleFlags
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moresource§impl Debug for ExampleFlags
source§impl From<ExampleFlags> for ExampleField
Returns a field instance from a flag.
+source§fn from(value: ExampleFlags) -> ExampleField
Converts to this type from the input type.source§impl From<ExampleFlags> for u8
Returns a flag as its corresponding u8 value.
+source§fn from(value: ExampleFlags) -> u8
Converts to this type from the input type.source§impl From<u8> for ExampleFlags
Converts a u8 to a flag
Errors
-Panics if the supplied u8 is out of range for fields base type.
-eg: for a 16-bit field (using u16),
+
Panics if the supplied u8 is out of range for fields base type.
+eg: for a 16-bit field (using u16),
providing an index of 20 will cause a panic.
-sourcefn from(value: u8) -> ExampleFlags
Performs the conversion.
-sourceimpl PartialEq<ExampleFlags> for ExampleFlags
sourceimpl PartialOrd<ExampleFlags> for ExampleFlags
sourcefn partial_cmp(&self, other: &ExampleFlags) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
-1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
-1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
-operator. Read more
-sourceimpl Copy for ExampleFlags
sourceimpl StructuralPartialEq for ExampleFlags
sourceimpl TriviallyTransmutable for ExampleFlags
Auto Trait Implementations
impl RefUnwindSafe for ExampleFlags
impl Send for ExampleFlags
impl Sync for ExampleFlags
impl Unpin for ExampleFlags
impl UnwindSafe for ExampleFlags
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
-sourceimpl<T, U> Into<U> for T where
U: From<T>,
const: unstable · sourcepub fn into(self) -> U
Calls U::from(self).
+source§fn from(value: u8) -> ExampleFlags
Converts to this type from the input type.source§impl PartialEq<ExampleFlags> for ExampleFlags
source§fn eq(&self, other: &ExampleFlags) -> bool
This method tests for self and other values to be equal, and is used
+by ==.source§impl PartialOrd<ExampleFlags> for ExampleFlags
source§fn partial_cmp(&self, other: &ExampleFlags) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
+operator. Read moresource§impl Copy for ExampleFlags
source§impl StructuralPartialEq for ExampleFlags
source§impl TriviallyTransmutable for ExampleFlags
Auto Trait Implementations§
§impl RefUnwindSafe for ExampleFlags
§impl Send for ExampleFlags
§impl Sync for ExampleFlags
§impl Unpin for ExampleFlags
§impl UnwindSafe for ExampleFlags
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
+ T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresourceimpl<T> ToOwned for T where
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
-sourcepub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
-sourcepub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
-
-
\ No newline at end of file
+From<T> for U chooses to do.
+Example of generated output, using both a bit field and a flag enum.
+Example of generated output, using both a bit field and a flag enum.
This module is only compiled with documentation builds and will not be available for import.
-use the bitfield macro to generate a field struct and flag enum.
Optional docstring for my example bit field.
-Optional docstring for my flag enum.
-use the bitfield macro to generate a field struct and flag enum.
pub struct ExampleField(_);Optional docstring for my example bit field.
-Constant values describing ExampleField.
Number of bits in an instance of ExampleField.
Number of bytes used by an instance of ExampleField.
Maximum valid integer for ExampleField.
Constructors for creating instances of ExampleField.
Create a new instance of ExampleField from a u8 value.
Create a new instance of ExampleField from 0.
Create a new instance of ExampleField from the maximum possible integer value.
Create a new instance of ExampleField from a binary string.
Create a new instance of ExampleField from a binary string.
Current state of this bitfield.
-Field accessors by index for ExampleField.
Returns the value of the bit at the supplied index as a boolean.
-Sets the value of the bit at the supplied index to 0.
Flips the value of the bit at the supplied index.
-Named field accessors by ExampleFlags for ExampleField.
Returns the value of the bit at the supplied flag as a boolean.
-Sets the value of the bit at the supplied flag to 1.
Sets the value of the bit at the supplied flag to 0.
Flips the value of the bit at the supplied flag.
-Combinators for ExampleField.
Returns a new ExampleFieldwith ones for flags that do not match. Does not consume self.
Returns a new ExampleFieldwith ones for flags that were set on either input. Does not consume self.
Returns a new ExampleFieldwith ones for flags that were set on both inputs. Does not consume self.
Conversion methods.
-Returns a new ExampleFieldwith ones for flags that do not match. Consumes self.
Returns a new ExampleFieldwith ones for flags that were set on either input. Consumes self.
Returns a new ExampleFieldwith ones for flags that were set on both inputs. Consumes self.
The resulting type after applying the & operator.
Performs the & operation. Read more
The resulting type after applying the & operator.
Performs the & operation. Read more
The resulting type after applying the & operator.
Performs the & operation. Read more
Performs the &= operation. Read more
Performs the &= operation. Read more
The resulting type after applying the | operator.
Performs the | operation. Read more
The resulting type after applying the | operator.
Performs the | operation. Read more
The resulting type after applying the | operator.
Performs the | operation. Read more
Performs the |= operation. Read more
Performs the |= operation. Read more
The resulting type after applying the ^ operator.
Performs the ^ operation. Read more
The resulting type after applying the ^ operator.
Performs the ^ operation. Read more
The resulting type after applying the ^ operator.
Performs the ^ operation. Read more
Performs the ^= operation. Read more
Performs the ^= operation. Read more
Returns a copy of the value. Read more
-Performs copy-assignment from source. Read more
Returns a field instance from a flag.
-Performs the conversion.
-Returns a field instance from value of its underlying type.
-Performs the conversion.
-This method tests for self and other values to be equal, and is used
-by ==. Read more
This method tests for !=.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
-operator. Read more
Mutably borrows from an owned value. Read more
-Calls U::from(self).
pub struct ExampleField(_);Optional docstring for my example bit field.
+Constant values describing ExampleField.
Number of bits in an instance of ExampleField.
Number of bytes used by an instance of ExampleField.
Maximum valid integer for ExampleField.
Constructors for creating instances of ExampleField.
Create a new instance of ExampleField from a u8 value.
Create a new instance of ExampleField from 0.
Create a new instance of ExampleField from the maximum possible integer value.
Create a new instance of ExampleField from a binary string.
Create a new instance of ExampleField from a binary string.
Current state of this bitfield.
+Field accessors by index for ExampleField.
Returns the value of the bit at the supplied index as a boolean.
+Sets the value of the bit at the supplied index to 0.
Flips the value of the bit at the supplied index.
+Named field accessors by ExampleFlags for ExampleField.
Returns the value of the bit at the supplied flag as a boolean.
+Sets the value of the bit at the supplied flag to 1.
Sets the value of the bit at the supplied flag to 0.
Flips the value of the bit at the supplied flag.
+Combinators for ExampleField.
Returns a new ExampleFieldwith ones for flags that do not match. Does not consume self.
Returns a new ExampleFieldwith ones for flags that were set on either input. Does not consume self.
Returns a new ExampleFieldwith ones for flags that were set on both inputs. Does not consume self.
Conversion methods.
+Returns a new ExampleFieldwith ones for flags that do not match. Consumes self.
Returns a new ExampleFieldwith ones for flags that were set on either input. Consumes self.
Returns a new ExampleFieldwith ones for flags that were set on both inputs. Consumes self.
& operator.& operator.& operator.&= operation. Read more&= operation. Read more| operator.| operator.| operator.|= operation. Read more|= operation. Read more^ operator.^ operator.^ operator.^= operation. Read more^= operation. Read moresource. Read moreReturns a field instance from a flag.
+Returns a field instance from value of its underlying type.
+self and other values to be equal, and is used
+by ==.self and other) and is used by the <=
+operator. Read moreThe resulting type after obtaining ownership.
-Creates owned data from borrowed data, usually by cloning. Read more
-toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
-From<T> for U chooses to do.
+Examples of generated output using different configurations.
+Examples of generated output using different configurations.
This module is only compiled with documentation builds and will not be available for import.
-use the bitfield macro to generate a field struct and flag enum.
Example of generated output, using only a bit field without a flag enum.
-Example of generated output, using both a bit field and a flag enum.
-use the bitfield macro to generate a field struct and flag enum.
Supports field widths of 8, 16, 32, 64 and 128 bits.
bitfield - macro documentation.examples - examples of the output generated by the bitfield macro.bitfield - macro documentation.examples - examples of the output generated by the bitfield macro.Note: the example module is only complied with documentation builds and is not available for importing in the wild.
@@ -23,193 +17,194 @@Generate a bitfield struct with a flag enum… (The following examples all use this as a definition.)
-use ubits::bitfield;
-
- bitfield! {
- pub u8 ExampleField
- ExampleFlags {
- 0 : Flag0,
- 1 : Flag1,
- 2 : Flag2,
- 3 : Flag3,
- 4 : Flag4,
- 5 : Flag5,
- 6 : Flag6,
- 7 : Flag7,
+use ubits::bitfield;
+
+ bitfield! {
+ pub u8 ExampleField
+ ExampleFlags {
+ 0 : Flag0,
+ 1 : Flag1,
+ 2 : Flag2,
+ 3 : Flag3,
+ 4 : Flag4,
+ 5 : Flag5,
+ 6 : Flag6,
+ 7 : Flag7,
}
}
Instances
From integer:
-let from_integer = ExampleField(123);
-assert_eq!(ExampleField(123), from_integer);
+let from_integer = ExampleField(123);
+assert_eq!(ExampleField(123), from_integer);From a binary string:
-let from_binary = ExampleField::from_binary_str("01111011");
-assert_eq!(ExampleField(123), from_binary)From ones:
-let from_ones = ExampleField::ones();
-assert_eq!("11111111", from_ones.as_binary());
-assert_eq!(255, from_ones.as_integer());From zeros:
-let from_zeros = ExampleField::zeros();
-assert_eq!("00000000", from_zeros.as_binary());
-assert_eq!(0, from_zeros.as_integer());Get bit value by field:
-let field = ExampleField::from_binary_str("01010101");
-assert!(field.get(ExampleFlags::Flag0));
-assert!(!field.get(ExampleFlags::Flag1));Get bit value by index:
-let field = ExampleField::from_binary_str("01010101");
-assert!(field.get_index(0));
-assert!(!field.get_index(1));Set bit value by field:
-let mut field = ExampleField::from_binary_str("01010101");
-field.set(ExampleFlags::Flag1);
-field.set(ExampleFlags::Flag3);
-assert_eq!("01011111", field.as_binary());Set bit value by index:
-let mut field = ExampleField::from_binary_str("01010101");
-field.set_index(1);
-field.set_index(3);
-assert_eq!("01011111", field.as_binary());Clear bit value by field:
-let mut field = ExampleField::from_binary_str("01010101");
-field.clear(ExampleFlags::Flag0);
-field.clear(ExampleFlags::Flag2);
-assert_eq!("01010000", field.as_binary());Clear bit value by index:
-let mut field = ExampleField::from_binary_str("01010101");
-field.clear_index(0);
-field.clear_index(2);
-assert_eq!("01010000", field.as_binary());Toggle bit value by field:
-let mut field = ExampleField::from_binary_str("01010101");
-field.toggle(ExampleFlags::Flag0);
-assert_eq!("01010100", field.as_binary());
-field.toggle(ExampleFlags::Flag0);
-assert_eq!("01010101", field.as_binary());Toggle bit value by index:
-let mut field = ExampleField::from_binary_str("01010101");
-field.toggle_index(0);
-assert_eq!("01010100", field.as_binary());
-field.toggle_index(0);
-assert_eq!("01010101", field.as_binary());Ubits can generate getter and setter methods for zero or more fields, if a name is provided.
-use ubits::bitfield;
- bitfield! {
- pub u8 ExampleField
- ExampleFlags {
- 0 : Flag0 : (field_0), // is_field_0 & set_field_0 & clear_field_0 & toggle_field_0
- 1 : Flag1 : (field_1), // is_field_1 & set_field_1 & clear_field_1 & toggle_field_1
- 2 : Flag2,
- 3 : Flag3,
- 4 : Flag4,
- 5 : Flag5,
- 6 : Flag6,
- 7 : Flag7,
+use ubits::bitfield;
+ bitfield! {
+ pub u8 ExampleField
+ ExampleFlags {
+ 0 : Flag0 : (field_0), // is_field_0 & set_field_0 & clear_field_0 & toggle_field_0
+ 1 : Flag1 : (field_1), // is_field_1 & set_field_1 & clear_field_1 & toggle_field_1
+ 2 : Flag2,
+ 3 : Flag3,
+ 4 : Flag4,
+ 5 : Flag5,
+ 6 : Flag6,
+ 7 : Flag7,
}
}
-let mut field = ExampleField::from_binary_str("01010101");
-assert_eq!(true, field.is_field_0());
-assert_eq!(false, field.is_field_1());
+let mut field = ExampleField::from_binary_str("01010101");
+assert_eq!(true, field.is_field_0());
+assert_eq!(false, field.is_field_1());
-field.set_field_1();
-assert_eq!(true, field.is_field_1());
+field.set_field_1();
+assert_eq!(true, field.is_field_1());
-field.clear_field_1();
-assert_eq!(false, field.is_field_1());
+field.clear_field_1();
+assert_eq!(false, field.is_field_1());
-field.toggle_field_1();
-assert_eq!(true, field.is_field_1());
+field.toggle_field_1();
+assert_eq!(true, field.is_field_1());Combine bit fields:
(use into_combined to consume self)
-let mut a = ExampleField::from_binary_str("01010101");
-let b = ExampleField::from_binary_str("10101010");
-assert_eq!("11111111", a.combine(b).as_binary());Get the intersection of two bitfields:
(use into_intersection to consume self)
-let mut a = ExampleField::from_binary_str("11000011");
-let b = ExampleField::from_binary_str("01111110");
-assert_eq!("01000010", a.intersect(b).as_binary());Get the diff of two bitfields:
(use into_diff to consume self)
-let mut a = ExampleField::from_binary_str("11000011");
-let b = ExampleField::from_binary_str("01100110");
-assert_eq!("10100101", a.diff(b).as_binary());Both bit field instances and flags use bitwise operators to change bit values.
-let mut from_zeros = ExampleField::zeros();
-assert_eq!("00000000", from_zeros.as_binary());
+let mut from_zeros = ExampleField::zeros();
+assert_eq!("00000000", from_zeros.as_binary());
-// set bit to 1
-from_zeros |= ExampleFlags::Flag1;
-assert_eq!("00000010", from_zeros.as_binary());
+// set bit to 1
+from_zeros |= ExampleFlags::Flag1;
+assert_eq!("00000010", from_zeros.as_binary());
-// set bit back to 0
-from_zeros &= ExampleFlags::Flag1;
-assert_eq!("00000000", from_zeros.as_binary());
+// set bit back to 0
+from_zeros &= ExampleFlags::Flag1;
+assert_eq!("00000000", from_zeros.as_binary());
-// toggle a bit
-from_zeros ^= ExampleFlags::Flag1;
-assert_eq!("00000010", from_zeros.as_binary());
+// toggle a bit
+from_zeros ^= ExampleFlags::Flag1;
+assert_eq!("00000010", from_zeros.as_binary());
-from_zeros ^= ExampleFlags::Flag1;
-assert_eq!("00000000", from_zeros.as_binary());Operations can also be chained together:
-let mut from_zeros = ExampleField::zeros() | ExampleFlags::Flag1 | ExampleFlags::Flag3;
-assert_eq!("00001010", from_zeros.as_binary());
+let mut from_zeros = ExampleField::zeros() | ExampleFlags::Flag1 | ExampleFlags::Flag3;
+assert_eq!("00001010", from_zeros.as_binary());
Bitfield instances can also be created from combining flags:
-let mut from_zeros = ExampleFlags::Flag1 | ExampleFlags::Flag3;
-assert_eq!("00001010", from_zeros.as_binary());
+let mut from_zeros = ExampleFlags::Flag1 | ExampleFlags::Flag3;
+assert_eq!("00001010", from_zeros.as_binary());
The generated flags enum allows you to access bits by name.
-The flag has an associated u8 value,
+The flag has an associated u8 value,
which determines the index its target bit.
-(See bitfield for more info)
bitfield for more info)
With the following input…
-1 0 1 0 0 1 1 01 0 1 0 0 1 1 0
+and the following flags…
0 : f1
1 : f1
@@ -218,7 +213,8 @@ Fields named
4 : f4
5 : f5
6 : f6
-7 : f7
we end up with this layout.