{"id":16162502,"url":"https://github.com/sunsided/free-list-rs","last_synced_at":"2025-04-07T03:48:15.054Z","repository":{"id":141992921,"uuid":"483396134","full_name":"sunsided/free-list-rs","owner":"sunsided","description":"An indexed free list with constant-time removals from anywhere.","archived":false,"fork":false,"pushed_at":"2024-02-26T11:27:24.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-13T08:28:21.893Z","etag":null,"topics":["free-list","library","rust"],"latest_commit_sha":null,"homepage":"","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":null,"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":"2022-04-19T20:16:00.000Z","updated_at":"2023-04-06T12:48:42.000Z","dependencies_parsed_at":"2024-02-26T12:53:00.511Z","dependency_job_id":null,"html_url":"https://github.com/sunsided/free-list-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Ffree-list-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Ffree-list-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Ffree-list-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Ffree-list-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunsided","download_url":"https://codeload.github.com/sunsided/free-list-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247589835,"owners_count":20963022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["free-list","library","rust"],"created_at":"2024-10-10T02:30:25.974Z","updated_at":"2025-04-07T03:48:15.033Z","avatar_url":"https://github.com/sunsided.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# free-list\n\nAn indexed free list with constant-time removals from anywhere\nin the list without invalidating indices. The underlying implementation\nis similar to that of [slotmap](https://github.com/orlp/slotmap) but\ndoesn't provide generational indexing.\n\nThis implementation is meant to be used solely in tightly controlled\nenvironments since it sacrifices indexing safety for performance.\n\nRetrieval of elements is an unsafe operation and the user needs to\nensure that the slot was not previously erased. Accessing an erased\nslot results in undefined behavior.\n\n```rust\nuse free_list::FreeList;\n\nfn example() {\n    let mut list = FreeList::\u003c\u0026str, u8\u003e::default();\n    assert_eq!(list.push(\"first\"), 0);\n    assert_eq!(list.push(\"second\"), 1);\n\n    let element = unsafe { list.at(0) };\n    assert_eq!(*element, \"first\");\n}\n```\n\nAfter removal of an item, the list is not compacted and the previously\nallocated slot can be immediately reused:\n\n```rust\nuse free_list::FreeList;\n\nfn example() {\n    let mut list = FreeList::\u003c\u0026str, u8\u003e::default();\n    list.push(\"first\");\n\n    // After erasing the just-inserted element, the capacity stays at\n    // 1 because the list is not compacted.\n    list.erase(0);\n    assert_eq!(list.capacity(), 1);\n\n    // After inserting again, the capacity is still 1 because\n    // the slot was reused.\n    list.push(\"second\");\n    assert_eq!(list.capacity(), 1);\n\n    // When the list is cleared completely, all slots are freed.\n    list.clear();\n    assert_eq!(list.capacity(), 0);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Ffree-list-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunsided%2Ffree-list-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Ffree-list-rs/lists"}