{"id":16346390,"url":"https://github.com/milesgranger/baggie","last_synced_at":"2025-11-08T09:30:31.941Z","repository":{"id":52419462,"uuid":"162884011","full_name":"milesgranger/baggie","owner":"milesgranger","description":"Container for mixed / heterogeneous values, in the form of a HashMap","archived":false,"fork":false,"pushed_at":"2021-04-29T19:40:04.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T20:28:27.668Z","etag":null,"topics":["bag","collection","collections","hashmap","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/milesgranger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-23T11:11:59.000Z","updated_at":"2021-04-29T19:40:04.000Z","dependencies_parsed_at":"2022-09-04T11:00:09.360Z","dependency_job_id":null,"html_url":"https://github.com/milesgranger/baggie","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fbaggie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fbaggie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fbaggie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fbaggie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milesgranger","download_url":"https://codeload.github.com/milesgranger/baggie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239550272,"owners_count":19657541,"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":["bag","collection","collections","hashmap","rust"],"created_at":"2024-10-11T00:35:14.296Z","updated_at":"2025-11-08T09:30:31.877Z","avatar_url":"https://github.com/milesgranger.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# baggie\n\n---\n\n[![Build Status](https://travis-ci.com/milesgranger/baggie.svg?branch=master)](https://travis-ci.com/milesgranger/baggie)\n[![crates.io](http://meritbadge.herokuapp.com/baggie)](https://crates.io/crates/baggie)\n[![Coverage Status](https://coveralls.io/repos/github/milesgranger/baggie/badge.svg?branch=master)](https://coveralls.io/github/milesgranger/baggie?branch=master)\n\n`Baggie` is simple interface for storing any type of element in a `HashMap`. \nThe crate has no dependencies, and is really just a helper around storing and \nfetching `Any`s from a `HashMap`. It has no unsafe code and free of any unwraps \nor similar misgivings.\n\nThe `Baggie` implements a subset of methods found in HashMap.\n\nThe downside of this crate is you must know the type of what you stored later on. \nTypically this shouldn't be a problem, as you could keep some metadata structure \ndescribing what types belong to what keys you've stored.\n\n_Sometimes_ you might need a tool like this, but _most times_ you should be using an enum. :)\n\n```rust\nuse baggie::Baggie;\n\nlet mut bag = Baggie::new();\n\n// Insert any value type you wish...\nbag.insert(\"key1\", \"Value1\".to_owned());\nbag.insert(\"key2\", vec![\"value\", \"2\"]);\nbag.insert(\"key3\", 3);\n\n// Get a reference\nlet val3 = bag.get::\u003ci32, _\u003e(\"key3\");\nassert_eq!(Some(\u00263), val3);\n\n// Get a mutable reference\nlet val2: Option\u003c\u0026mut Vec\u003c\u0026str\u003e\u003e = bag.get_mut(\"key2\");\nmatch val2 {\n    Some(v) =\u003e *v = vec![\"new\", \"value\", \"2\"],\n    None =\u003e panic!()\n}\nlet val2: \u0026mut Vec\u003c\u0026str\u003e = bag.get_mut(\"key2\").unwrap();\nassert_eq!(val2, \u0026mut vec![\"new\", \"value\", \"2\"]);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilesgranger%2Fbaggie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilesgranger%2Fbaggie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilesgranger%2Fbaggie/lists"}