{"id":18495797,"url":"https://github.com/sunjay/component_group","last_synced_at":"2025-04-08T22:31:57.646Z","repository":{"id":57609694,"uuid":"160887648","full_name":"sunjay/component_group","owner":"sunjay","description":"A Rust crate for working with a group of Components (in the Specs ECS)","archived":false,"fork":false,"pushed_at":"2020-12-24T03:53:52.000Z","size":64,"stargazers_count":20,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-23T19:11:57.980Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.rs/component_group","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunjay.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-08T00:03:22.000Z","updated_at":"2022-08-20T05:44:38.000Z","dependencies_parsed_at":"2022-08-27T11:32:37.763Z","dependency_job_id":null,"html_url":"https://github.com/sunjay/component_group","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/sunjay%2Fcomponent_group","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunjay%2Fcomponent_group/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunjay%2Fcomponent_group/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunjay%2Fcomponent_group/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunjay","download_url":"https://codeload.github.com/sunjay/component_group/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247940574,"owners_count":21022007,"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-11-06T13:26:19.741Z","updated_at":"2025-04-08T22:31:54.128Z","avatar_url":"https://github.com/sunjay.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# component_group\n\n[![Crates.io](https://img.shields.io/crates/v/component_group.svg)](https://crates.io/crates/component_group)\n[![Docs.rs](https://docs.rs/component_group/badge.svg)](https://docs.rs/component_group)\n[![Build Status](https://travis-ci.com/sunjay/component_group.svg?token=i5M6iNHVbWshsp6jHWxw\u0026branch=master)](https://travis-ci.com/sunjay/component_group)\n[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/sunjay)\n\nThis crate defines the `ComponentGroup` trait. This trait is used to make\nmanaging a group of [`specs::Component`] instances easier. This is useful for\nwhen you have several components that are often created, read, and updated\ntogether. You can use this trait to easily move an entire group of components\nbetween instances of [`specs::World`].\n\nInstead of having you keep duplicate code in sync across your application, this\ntrait groups all of that logic in one place so you can focus and minimize the\nchanges you need to make every time you add a component to the group.\n\nThe `ComponentGroup` trait can be automatically derived if each component in the\ngroup implements the `Clone` trait. This removes any of the boilerplate you may\nhave needed to write in order to implement the trait yourself.\n\nSee [**the documentation**][docs] for more details about the motivations for\ncreating this trait and how to use it.\n\n```rust\n// Don't forget to add the component_group crate to your Cargo.toml file!\nuse component_group::ComponentGroup;\n\nuse specs::{World, Component, VecStorage, HashMapStorage};\nuse specs_derive::Component;\n\n// These components are just for demonstration purposes. You should swap them\n// out for your own. Components need to be Clone to use the automatic derive.\n\n#[derive(Debug, Clone, Component)]\n#[storage(VecStorage)]\npub struct Position {x: i32, y: i32}\n\n#[derive(Debug, Clone, Component)]\n#[storage(VecStorage)]\npub struct Velocity {x: i32, y: i32}\n\n#[derive(Debug, Clone, Component)]\n#[storage(VecStorage)]\npub struct Health(u32);\n\n#[derive(Debug, Clone, Component)]\n#[storage(HashMapStorage)]\npub struct Animation {frame: usize}\n\n// This is all of the code you need to write to define the group and its operations!\n#[derive(ComponentGroup)]\nstruct PlayerComponents {\n    position: Position,\n    velocity: Velocity,\n    health: Health,\n    // This optional component is allowed to not be present\n    animation: Option\u003cAnimation\u003e,\n}\n\n// Now you can easily add all of these components to an entity, load them all\n// from the world, or even update them all at once!\n```\n\n[`specs::Component`]: https://docs.rs/specs/*/specs/trait.Component.html\n[`specs::World`]: https://docs.rs/specs/*/specs/world/struct.World.html\n[docs]: https://docs.rs/component_group\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunjay%2Fcomponent_group","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunjay%2Fcomponent_group","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunjay%2Fcomponent_group/lists"}