{"id":13671698,"url":"https://github.com/koute/schnellru","last_synced_at":"2025-04-14T22:13:21.959Z","repository":{"id":64990071,"uuid":"580451100","full_name":"koute/schnellru","owner":"koute","description":"A fast and flexible LRU map.","archived":false,"fork":false,"pushed_at":"2025-01-03T08:23:55.000Z","size":89,"stargazers_count":181,"open_issues_count":4,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T22:13:12.369Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koute.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-12-20T15:39:11.000Z","updated_at":"2025-04-04T03:01:09.000Z","dependencies_parsed_at":"2024-05-14T07:42:26.230Z","dependency_job_id":null,"html_url":"https://github.com/koute/schnellru","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":0.04166666666666663,"last_synced_commit":"5a8927e9ed4b11fdfb0f2115aa4d2577e30d6f05"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koute%2Fschnellru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koute%2Fschnellru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koute%2Fschnellru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koute%2Fschnellru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koute","download_url":"https://codeload.github.com/koute/schnellru/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968917,"owners_count":21191162,"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":[],"created_at":"2024-08-02T09:01:16.591Z","updated_at":"2025-04-14T22:13:21.934Z","avatar_url":"https://github.com/koute.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# A fast and flexible LRU map\n\n[![Documentation](https://docs.rs/schnellru/badge.svg)](https://docs.rs/schnellru/*/schnellru/)\n\nThis repository contains a fast and flexible LRU map.\n\n  * Blazingly fast. Up to twice as fast as the [`lru`](https://github.com/jeromefroe/lru-rs) crate, and with less memory overhead.\n  * Can be also used as an ordered map, with roughly the same performance as [`indexmap`](https://github.com/bluss/indexmap),\n    but with added support for O(1) removals without changing the element order (where `indexmap` only supports O(n) non-perturbing removals).\n  * Customizable. Out-of-box can be limited by length or by memory usage, but supports custom limiters which can be made to limit the map by whatever you want.\n  * Tested, miri-clean, clippy-clean and fuzzed.\n  * Supports `no_std`.\n\n## Examples\n\n```rust\nuse schnellru::{LruMap, ByLength};\nlet mut map = LruMap::new(ByLength::new(3));\n\n// Insert three elements.\nmap.insert(1, \"one\");\nmap.insert(2, \"two\");\nmap.insert(3, \"three\");\nassert_eq!(map.len(), 3);\n\n// They're ordered according to which one was inserted last.\nlet mut iter = map.iter();\nassert_eq!(iter.next().unwrap(), (\u00263, \u0026\"three\"));\nassert_eq!(iter.next().unwrap(), (\u00262, \u0026\"two\"));\nassert_eq!(iter.next().unwrap(), (\u00261, \u0026\"one\"));\n\n// Access the least recently inserted one.\nassert_eq!(*map.get(\u00261).unwrap(), \"one\");\n\n// Now the order's changed.\n// The element we've accessed was moved to the front.\nlet mut iter = map.iter();\nassert_eq!(iter.next().unwrap(), (\u00261, \u0026\"one\"));\nassert_eq!(iter.next().unwrap(), (\u00263, \u0026\"three\"));\nassert_eq!(iter.next().unwrap(), (\u00262, \u0026\"two\"));\n\n// Insert a fourth element.\n// This will automatically pop the least recently accessed one.\nmap.insert(4, \"four\");\n\n// Still the same number of elements.\nassert_eq!(map.len(), 3);\n\n// And this is the one which was removed.\nassert!(map.peek(\u00262).is_none());\n\n// And here's the new order.\nlet mut iter = map.iter();\nassert_eq!(iter.next().unwrap(), (\u00264, \u0026\"four\"));\nassert_eq!(iter.next().unwrap(), (\u00261, \u0026\"one\"));\nassert_eq!(iter.next().unwrap(), (\u00263, \u0026\"three\"));\n```\n\n## License\n\nLicensed under either of\n\n  * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n  * MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoute%2Fschnellru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoute%2Fschnellru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoute%2Fschnellru/lists"}