{"id":19541439,"url":"https://github.com/ickk/steady_vec","last_synced_at":"2025-09-25T23:30:19.705Z","repository":{"id":252895945,"uuid":"841816526","full_name":"ickk/steady_vec","owner":"ickk","description":"A heap allocated indexable array-like datastructure, that can grow without moving existing elements","archived":false,"fork":false,"pushed_at":"2024-08-13T09:58:15.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-02-26T05:18:43.627Z","etag":null,"topics":["datastructures"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ickk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2024-08-13T05:21:58.000Z","updated_at":"2024-08-13T09:58:18.000Z","dependencies_parsed_at":"2024-08-13T11:49:58.119Z","dependency_job_id":null,"html_url":"https://github.com/ickk/steady_vec","commit_stats":null,"previous_names":["ickk/steady_vec"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ickk/steady_vec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickk%2Fsteady_vec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickk%2Fsteady_vec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickk%2Fsteady_vec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickk%2Fsteady_vec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ickk","download_url":"https://codeload.github.com/ickk/steady_vec/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickk%2Fsteady_vec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276995435,"owners_count":25742012,"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","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["datastructures"],"created_at":"2024-11-11T03:10:29.759Z","updated_at":"2025-09-25T23:30:19.655Z","avatar_url":"https://github.com/ickk.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"`steady_vec`\n===============\n\n[`SteadyVec`] is a growable \"`Vec`-like\" datastructure that does not *move*\nelements on *resize*. It maintains the existing allocation whilst using new\nallocations for subsequent items.\n\nLike [`Vec`], it begins life without any allocation, then uses a\ncapacity-doubling strategy each time it runs out of space. It supports many of\nthe same methods: `push`, `pop`, `get`, `swap`, `insert`, `remove`, `iter`, \u0026c.\n\n### Architecture\n\nThe `SteadyVec` stores a `usize` length, and 31 pointers to each of the\noptional allocations. If all 31 allocations are used the total allocated\ncapacity is 2³².\n\nEach individual allocation has a fixed size based on its position;\n\n|**alloc**|`0`|`1`|`2`|`3`|`4`|`5`|`6`|`7`|...|`30`|\n|---------|---|---|---|---|---|---|---|---|---|----|\n| **size**| 4 | 4 | 8 | 16| 32| 64|128|256|...| 2³¹|\n\n![diagram](diagram.svg)\n\n### why?\n\nWhen a rust `Vec` becomes full, it *resizes*, which is a process of allocating\na new vector with twice the capacity and then *moving* every element from the\noriginal vector into the new vector. Sometimes you need a growable\n\"vector-like\" thing, but you also need elements not to *move* on growth.\n\nTrade-offs:\n- It is not possible to get slices over arbitrary ranges, as the underlying\n  elements may not be contiguous in memory.\n- `SteadyVec\u003cT\u003e`'s stack-size is large (~256 bytes on 64 bit architectures), so\n  stack moves are more expensive. You can use a `Box\u003cSteadyVec\u003cT\u003e\u003e` to mitigate\n  this, but that requires an extra indirection for every access.\n\nSince `SteadyVec` guarantees that elements will not *move* when growing (or\nshrinking), it may be a useful primitive in the design of certain\ndatastructures that provide concurrent access.\n\n\nFuture work\n-----------\n\nMuch of the API surface area of `Vec` has been replicated for `SteadyVec`, but\nthere are still outstanding methods \u0026 traits including:\n\n- binary_search\n- sort\n\n\nLicense\n-------\n\nThis crate is licensed under any of the\n[Apache license, Version 2.0](./LICENSE-APACHE),\nor the\n[MIT license](./LICENSE-MIT),\nor the\n[Zlib license](./LICENSE-ZLIB)\nat your option.\n\nUnless explicitly stated otherwise, any contributions you intentionally submit\nfor inclusion in this work shall be licensed accordingly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickk%2Fsteady_vec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fickk%2Fsteady_vec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickk%2Fsteady_vec/lists"}