{"id":16162361,"url":"https://github.com/sunsided/swap3-rs","last_synced_at":"2026-03-03T10:31:54.795Z","repository":{"id":180231456,"uuid":"664830470","full_name":"sunsided/swap3-rs","owner":"sunsided","description":"Swapping of three references, rotating the values left or right","archived":false,"fork":false,"pushed_at":"2024-05-11T17:16:00.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-20T04:37:39.466Z","etag":null,"topics":["binary-tree","rotate-array","rust","swapping","swapping-algorithm","tree-algorithms"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/swap3","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/sunsided.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2023-07-10T21:05:30.000Z","updated_at":"2024-05-11T17:16:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5c3f6f6-a06e-4590-8971-9fcd1df9de64","html_url":"https://github.com/sunsided/swap3-rs","commit_stats":null,"previous_names":["sunsided/swap3-rs"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/sunsided/swap3-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fswap3-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fswap3-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fswap3-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fswap3-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunsided","download_url":"https://codeload.github.com/sunsided/swap3-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Fswap3-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30041282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T10:28:37.494Z","status":"ssl_error","status_checked_at":"2026-03-03T10:28:28.686Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["binary-tree","rotate-array","rust","swapping","swapping-algorithm","tree-algorithms"],"created_at":"2024-10-10T02:29:52.864Z","updated_at":"2026-03-03T10:31:54.774Z","avatar_url":"https://github.com/sunsided.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swap3\n\n[![codecov](https://codecov.io/gh/sunsided/swap3-rs/graph/badge.svg?token=MSO2LJWX6X)](https://codecov.io/gh/sunsided/swap3-rs)\n\nProvides utility functions for simultaneously swapping three values by rotating them\neither left (`abc` → `bca`) or right (`abc` → `cab`). These functions can come in handy e.g.\nwhen rotating elements of a binary tree in list representation.\n\nThe provided functions work on arbitrary types and do *not* require the type to be `Clone`, `Copy`\nor `Default`.\n\n## Examples\n\nFor individual references, the `swap3_bca` (rotate left) and `swap3_cab` (rotate right)\nfunctions are available:\n\n```rust\nfn swap3_bca() {\n    let mut a = 10;\n    let mut b = 20;\n    let mut c = 30;\n\n    swap3::swap3_bca(\u0026mut a, \u0026mut b, \u0026mut c);\n    assert_eq!([a, b, c], [20, 30, 10]);\n}\n```\n\nFor slices, the `swap3_bca_slice` and `swap3_cab_slice` functions can be used:\n\n```rust\nuse swap3::prelude::*;\n\nfn swap3_bca() {\n    let mut vec = vec![10, 20, 30, 40, 50, 60];\n    vec.swap3_bca(0, 1, 4); // or swap3_bca_slice(\u0026mut vec, 0, 1, 4)\n    assert_eq!(vec, \u0026[20, 50, 30, 40, 10, 60]);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Fswap3-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunsided%2Fswap3-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Fswap3-rs/lists"}