{"id":21576358,"url":"https://github.com/sigurd4/slice_ops","last_synced_at":"2026-02-14T05:03:10.497Z","repository":{"id":214556952,"uuid":"736812138","full_name":"sigurd4/slice_ops","owner":"sigurd4","description":"A selection of useful slice operations that run at compile-time","archived":false,"fork":false,"pushed_at":"2025-02-17T18:13:16.000Z","size":92,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T17:02:49.151Z","etag":null,"topics":["misc","miscellaneous","slice","slice-manipulations","slice-methods","slice-operations","slice-utilities","slice-utility","slices","slices-utilities","slices-utility","useful","util","utility"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/slice_ops","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sigurd4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-29T00:25:24.000Z","updated_at":"2025-09-28T20:35:14.000Z","dependencies_parsed_at":"2024-03-19T14:52:42.479Z","dependency_job_id":"91c4b524-60cd-448f-bc0d-6396de66210f","html_url":"https://github.com/sigurd4/slice_ops","commit_stats":null,"previous_names":["sigurd4/slice_ops"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sigurd4/slice_ops","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fslice_ops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fslice_ops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fslice_ops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fslice_ops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigurd4","download_url":"https://codeload.github.com/sigurd4/slice_ops/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Fslice_ops/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29437368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T03:34:37.767Z","status":"ssl_error","status_checked_at":"2026-02-14T03:34:09.092Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["misc","miscellaneous","slice","slice-manipulations","slice-methods","slice-operations","slice-utilities","slice-utility","slices","slices-utilities","slices-utility","useful","util","utility"],"created_at":"2024-11-24T12:16:15.524Z","updated_at":"2026-02-14T05:03:10.476Z","avatar_url":"https://github.com/sigurd4.png","language":"Rust","readme":"[![Build Status (nightly)](https://github.com/sigurd4/slice_ops/workflows/Build-nightly/badge.svg)](https://github.com/sigurd4/slice_ops/actions/workflows/build-nightly.yml)\n[![Build Status (nightly, all features)](https://github.com/sigurd4/slice_ops/workflows/Build-nightly-all-features/badge.svg)](https://github.com/sigurd4/slice_ops/actions/workflows/build-nightly-all-features.yml)\n\n[![Build Status (stable)](https://github.com/sigurd4/slice_ops/workflows/Build-stable/badge.svg)](https://github.com/sigurd4/slice_ops/actions/workflows/build-stable.yml)\n[![Build Status (stable, all features)](https://github.com/sigurd4/slice_ops/workflows/Build-stable-all-features/badge.svg)](https://github.com/sigurd4/slice_ops/actions/workflows/build-stable-all-features.yml)\n\n[![Test Status](https://github.com/sigurd4/slice_ops/workflows/Test/badge.svg)](https://github.com/sigurd4/slice_ops/actions/workflows/test.yml)\n[![Lint Status](https://github.com/sigurd4/slice_ops/workflows/Lint/badge.svg)](https://github.com/sigurd4/slice_ops/actions/workflows/lint.yml)\n\n[![Latest Version](https://img.shields.io/crates/v/slice_ops.svg)](https://crates.io/crates/slice_ops)\n[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Documentation](https://img.shields.io/docsrs/slice_ops)](https://docs.rs/slice_ops)\n[![Coverage Status](https://img.shields.io/codecov/c/github/sigurd4/slice_ops)](https://app.codecov.io/github/sigurd4/slice_ops)\n\n# slice_ops\n\nProvides many useful utility methods for slices.\n\nThis crate is a subset of the crate [`array__ops`](https://crates.io/crates/array__ops).\n\n## integrate / differentiate\n\n- `integrate`\n- `differentiate`\n\n```rust\nuse slice_ops::ops::*;\n\nlet mut x = [1, 5, 5, 6, 2, -1, 0, 0, 0];\n\nx.differentiate();\n\nassert_eq!(x, [1, 4, 0, 1, -4, -3, 1, 0, 0]);\n\nx.integrate();\n\nassert_eq!(x, [1, 5, 5, 6, 2, -1, 0, 0, 0]);\n```\n\n## find\n\n- `find` / `rfind`\n- `find_by` / `rfind_by`\n- `find_by_key` / `rfind_by`\n\n```rust\nuse slice_ops::ops::*;\n\n//                   v\nlet x = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3];\n\nlet i = x.find(\u00265).unwrap();\n\nassert_eq!(i, 4);\nassert_eq!(x[i], 5);\n```\n\n## argmax / argmin\n\n- `argmax` / `argmin`\n- `argmax_by` / `argmin_by`\n- `argmax_by_key` / `argmin_by_key`\n\n```rust\nuse slice_ops::ops::*;\n\n//                v\nlet x = [1, 5, 5, 6, 2, -1, 0, -4, -1, 6];\n\nlet i = x.argmax().unwrap();\n\nassert_eq!(i, 3);\n```\n\n## visit\n\n- `visit` / `visit_mut`\n- `rvisit` / `rvisit_mut`\n- `visit_async` / `visit_mut_async`\n- `try_visit` / `try_visit_mut`\n- `try_rvisit` / `try_rvisit_mut`\n- `try_visit_async` / `try_visit_mut_async`\n\n```rust\nuse slice_ops::ops::*;\n\nlet mut x = [0; 8];\n\nlet mut i = 0;\n\nx.visit_mut(|e| {\n    i += 1;\n    *e = i;\n});\n\nassert_eq!(x, [1, 2, 3, 4, 5, 6, 7, 8]);\n```\n\n## ..._assign_all\n\n- `add_assign_all` / `add_assign_all_async`\n- `sub_assign_all` / `sub_assign_all_async`\n- `mul_assign_all` / `mul_assign_all_async`\n- `div_assign_all` / `div_assign_all_async`\n- `rem_assign_all` / `rem_assign_all_async`\n- `shl_assign_all` / `shl_assign_all_async`\n- `shr_assign_all` / `shr_assign_all_async`\n- `bitor_assign_all` / `bitor_assign_all_async`\n- `bitand_assign_all` / `bitand_assign_all_async`\n- `bitxor_assign_all` / `bitxor_assign_all_async`\n- `neg_assign_all` / `neg_assign_all_async`\n- `not_assign_all` / `not_assign_all_async`\n\n```rust\nuse slice_ops::ops::*;\n\nlet mut x = [1, 2, 3, 4, 5, 6, 7, 8];\n\nx.mul_assign_all(2);\n   \nassert_eq!(x, [2, 4, 6, 8, 10, 12, 14, 16]);\n```\n\n## shift\n\n- `shift_many_left` / `shift_many_right`\n- `shift_left` / `shift_right`\n\n```rust\nuse slice_ops::ops::*;\n\nlet mut register = [4, 5, 6, 7, 8, 9];\nlet mut io = [1, 2, 3];\n\nregister.shift_many_right(\u0026mut io);\n\nassert_eq!(register, [1, 2, 3, 4, 5, 6]);\nassert_eq!(io, [7, 8, 9]);\n```\n\n## spread\n\n- `spread` / `spread_mut`\n\n```rust\n#![feature(generic_const_exprs)]\n\nuse slice_ops::ops::*;\n\nlet arr = [1, 2, 3];\nlet slice = arr.as_slice();\n\nlet [odd, even] = slice.spread();\n\nassert_eq!(odd, [1, 3]);\nassert_eq!(even, [2]);\n```\n\n## bit_rev_permutation\n\n- `bit_rev_permutation`\n- `digit_rev_permutation`\n\n```rust\nuse slice_ops::ops::*;\n\nlet mut arr = [0b000, 0b001, 0b010, 0b011, 0b100, 0b101, 0b110, 0b111];\n\narr.bit_rev_permutation();\n\nassert_eq!(arr, [0b000, 0b100, 0b010, 0b110, 0b001, 0b101, 0b011, 0b111])\n```\n\n## grey_code_permutation\n\n- `grey_code_permutation`\n\n```rust\nuse slice_ops::ops::*;\n\nlet mut arr = [0b000, 0b001, 0b010, 0b011, 0b100, 0b101, 0b110, 0b111];\n\narr.as_mut_slice().grey_code_permutation();\n\nassert_eq!(arr, [0b000, 0b001, 0b011, 0b010, 0b110, 0b111, 0b101, 0b100])\n```\n\n## trim\n\n- `trim` / `trim_mut`\n- `trim_front` / `trim_front_mut`\n- `trim_back` / `trim_back_mut`\n\n```rust\nuse slice_ops::ops::*;\n\nlet arr = [0, 0, 0, 1, 2, 3, 0, 0, 0];\n\nlet trimmed = arr.trim(|\u0026e| e == 0);\n\nassert_eq!(trimmed, \u0026[1, 2, 3]);\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigurd4%2Fslice_ops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigurd4%2Fslice_ops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigurd4%2Fslice_ops/lists"}