{"id":25833958,"url":"https://github.com/netskillzgh/easy-pool","last_synced_at":"2026-06-13T05:31:45.559Z","repository":{"id":46329501,"uuid":"455597886","full_name":"netskillzgh/easy-pool","owner":"netskillzgh","description":null,"archived":false,"fork":false,"pushed_at":"2022-07-18T22:59:39.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T00:40:20.999Z","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/netskillzgh.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}},"created_at":"2022-02-04T15:27:15.000Z","updated_at":"2022-07-18T22:31:20.000Z","dependencies_parsed_at":"2022-09-19T14:32:16.920Z","dependency_job_id":null,"html_url":"https://github.com/netskillzgh/easy-pool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/netskillzgh/easy-pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netskillzgh%2Feasy-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netskillzgh%2Feasy-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netskillzgh%2Feasy-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netskillzgh%2Feasy-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netskillzgh","download_url":"https://codeload.github.com/netskillzgh/easy-pool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netskillzgh%2Feasy-pool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34273788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"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-02-28T23:49:04.374Z","updated_at":"2026-06-13T05:31:45.543Z","avatar_url":"https://github.com/netskillzgh.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://crates.io/crates/easy-pool\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/v/easy-pool.svg\"\n    alt=\"Crates\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://docs.rs/easy-pool\"\u003e\n    \u003cimg src=\"https://docs.rs/easy-pool/badge.svg\"\n    alt=\"Documentation\" /\u003e\n  \u003c/a\u003e\n   \u003ca href=\"https://github.com/netskillzgh/easy-pool#license\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\"\n    alt=\"License\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n```toml\n[dependencies]\neasy-pool = \"0.2.7\"\n```\n\nAn easy way to reuse your objects without reallocating memory every time.\n\n\u003chr\u003e\n\n## Simple example\n\n```rust, no_run\nuse std::sync::Arc;\n\nuse easy_pool::{Clear, EasyPoolMutex, PoolMutex};\n\n// It will create the pool and create the functions T::create_with \u0026 T::create.\n// This derive is optional but you have to create the pool yourself.\n// Like this : let pool = Arc::new(PoolMutex::with_config(1024, 1024));.\n#[derive(EasyPoolMutex, Default)]\nstruct Test {\n    pets: Vec\u003cString\u003e,\n}\n\nimpl Clear for Test {\n    fn clear(\u0026mut self) {\n        self.pets.clear();\n    }\n}\n\nfn main() {\n    // Easiest way.\n    let mut test = Test::create_with(|| Test {\n        pets: Vec::with_capacity(100),\n    });\n    assert_eq!(test.pets.capacity(), 100);\n    test.pets.push(\"Cat\".to_string());\n    assert_eq!(test.pets.first().unwrap(), \"Cat\");\n    test.pets.extend(vec![\"Dog\".to_string(); 100]);\n    assert_eq!(test.pets.len(), 101);\n    assert_eq!(test.pets.capacity(), 200);\n    drop(test);\n\n    // The function create will reuse the old \"test\".\n    let test = Test::create_with(|| Test {\n        pets: Vec::with_capacity(100),\n    });\n    assert_eq!(test.pets.len(), 0);\n    assert_eq!(test.pets.capacity(), 200);\n\n    // Or more complex.\n    let pool = Arc::new(PoolMutex::with_config(1024, 1024));\n    let result = pool.create_with(|| Test {\n        pets: Vec::with_capacity(100),\n    });\n    assert_eq!(result.pets.capacity(), 100);\n}\n```\n\n\u003chr\u003e\n\nImportant points to know:\n\n1. The pool is fully thread safe.\n\n2. The create_with function will execute the FnOnce if no object is available in the pool. If an object is available, the pool will retrieve the object and execute the clear () function.\n\n3. The create () function will create the object with the default () function if no object is available in the pool. If an object is available, the pool will retrieve the object and execute the clear () function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetskillzgh%2Feasy-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetskillzgh%2Feasy-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetskillzgh%2Feasy-pool/lists"}