{"id":30886785,"url":"https://github.com/canop/generational-buffer","last_synced_at":"2025-09-08T13:51:11.705Z","repository":{"id":303908591,"uuid":"1017203843","full_name":"Canop/generational-buffer","owner":"Canop","description":"A ring buffer with safe generational handles","archived":false,"fork":false,"pushed_at":"2025-07-12T20:51:50.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-28T22:57:04.987Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Canop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-07-10T07:21:22.000Z","updated_at":"2025-07-12T20:51:53.000Z","dependencies_parsed_at":"2025-07-10T12:20:41.634Z","dependency_job_id":"86535b7e-d51d-438b-9127-e74d707f2271","html_url":"https://github.com/Canop/generational-buffer","commit_stats":null,"previous_names":["canop/generational-buffer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Canop/generational-buffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fgenerational-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fgenerational-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fgenerational-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fgenerational-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Canop","download_url":"https://codeload.github.com/Canop/generational-buffer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fgenerational-buffer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274196022,"owners_count":25239148,"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-08T02:00:09.813Z","response_time":121,"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":[],"created_at":"2025-09-08T13:51:04.745Z","updated_at":"2025-09-08T13:51:11.686Z","avatar_url":"https://github.com/Canop.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![MIT][s2]][l2] [![Latest Version][s1]][l1] [![docs][s3]][l3] [![Chat on Miaou][s4]][l4]\n\n[s1]: https://img.shields.io/crates/v/generational-buffer.svg\n[l1]: https://crates.io/crates/generational-buffer\n\n[s2]: https://img.shields.io/badge/license-MIT-blue.svg\n[l2]: LICENSE\n\n[s3]: https://docs.rs/generational-buffer/badge.svg\n[l3]: https://docs.rs/generational-buffer/\n\n[s4]: https://miaou.dystroy.org/static/shields/room.svg\n[l4]: https://miaou.dystroy.org/3\n\n\nA ring buffer returning generational handles on insertion, so that\nyou can check if an item has been replaced since you got the handle.\n\nThis is safe and efficient, the storage is a simple vector not taking\nmore space than a minimal ring buffer.\n\n```\nlet mut buffer = generational_buffer::GenerationalBuffer::new(2);\n\n// Fill the buffer\nlet h1 = buffer.push(10);\nlet h2 = buffer.push(20);\n\n// Wrap around - this should invalidate h1\nlet h3 = buffer.push(30);\n\n// h1 should now be invalid due to generation mismatch\nassert_eq!(buffer.get(h1), None);\nassert_eq!(buffer.get(h2), Some(\u002620));\nassert_eq!(buffer.get(h3), Some(\u002630));\nassert!(!buffer.is_valid(h1));\nassert!(buffer.is_valid(h2));\nassert!(buffer.is_valid(h3));\nassert_eq!(buffer.len(), 2);\n\n// let's do one more turn\nlet h4 = buffer.push(40); // This should overwrite h2\nlet h5 = buffer.push(50); // This should overwrite h3\nassert_eq!(buffer.get(h4), Some(\u002640));\nassert_eq!(buffer.get(h5), Some(\u002650));\nassert!(!buffer.is_valid(h2)); // h2 should be invalid now\nassert!(!buffer.is_valid(h3)); // h3 should be invalid now\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fgenerational-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanop%2Fgenerational-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fgenerational-buffer/lists"}