{"id":17874455,"url":"https://github.com/fl03/contained","last_synced_at":"2025-12-27T09:45:57.355Z","repository":{"id":65806795,"uuid":"573605901","full_name":"FL03/contained","owner":"FL03","description":"Contained is a research project supporting the on-going efforts of scsys by implementing the proposed harmonic runtime for optimizing the orchestration of cloud-native systems","archived":false,"fork":false,"pushed_at":"2024-05-16T23:47:10.000Z","size":999,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T08:15:15.181Z","etag":null,"topics":["binary","cloud","harmonics","research","rust"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/jo3mccain/contained","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/FL03.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-02T21:59:04.000Z","updated_at":"2023-01-01T17:25:24.000Z","dependencies_parsed_at":"2024-10-28T11:53:39.224Z","dependency_job_id":null,"html_url":"https://github.com/FL03/contained","commit_stats":{"total_commits":395,"total_committers":3,"mean_commits":"131.66666666666666","dds":"0.012658227848101222","last_synced_commit":"188ede1a99a31a0e8691d72c6ada0c09b0295ecc"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/FL03/contained","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FL03%2Fcontained","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FL03%2Fcontained/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FL03%2Fcontained/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FL03%2Fcontained/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FL03","download_url":"https://codeload.github.com/FL03/contained/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FL03%2Fcontained/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264330520,"owners_count":23591954,"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":["binary","cloud","harmonics","research","rust"],"created_at":"2024-10-28T11:08:58.344Z","updated_at":"2025-10-26T08:10:24.537Z","avatar_url":"https://github.com/FL03.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# contained\r\n\r\n[![crates.io](https://img.shields.io/crates/v/contained?style=for-the-badge\u0026logo=rust)](https://crates.io/crates/contained)\r\n[![docs.rs](https://img.shields.io/docsrs/contained?style=for-the-badge\u0026logo=docs.rs)](https://docs.rs/contained)\r\n[![GitHub License](https://img.shields.io/github/license/fl03/contained?style=for-the-badge\u0026logo=github)](LICENSE)\r\n\r\n***\r\n\r\nWelcome to `contained`, a collection of macros and other utilities designed to facilitate the creation and manipulation of so-called wrapper types in Rust. Here, a wrapper type is essentially any object capable of implementing the `#[repr(transparent)]` attribute, such as newtypes, tuple structs, and single-field enums.\r\n\r\n## Usage\r\n\r\nBefore you start using `contained`, make sure to add it as a dependency in your `Cargo.toml` file. You can do this by adding the following lines:\r\n\r\n```toml\r\n[dependencies.contained]\r\nfeatures = [\r\n    \"derive\",\r\n]\r\nversion = \"0.2.x\"\r\n```\r\n\r\n### Examples\r\n\r\nFor more detailed examples, please visit the [examples](https://github.com/FL03/contained/tree/main/contained/examples) directory in the repository. Below are some brief examples highlighting certain features of the library.\r\n\r\n#### **Example 1**: Using the `Wrapper` derive macro\r\n\r\n```rust\r\nuse contained::Wrapper;\r\n\r\n#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Wrapper)]\r\npub struct A\u003cT\u003e(T);\r\n\r\nfn main() {\r\n    let mut a = A::new(1).map(|x| x + 100);\r\n    assert_eq!(a.get(), \u0026101);\r\n    a.set(202);\r\n    assert_eq!(a.get_mut(), \u0026mut 202);\r\n}\r\n```\r\n\r\n#### **Example 2**: Uisng the `fmt_wrapper` macro\r\n\r\n```rust\r\nuse contained::fmt_wrapper;\r\n\r\n#[derive(Clone, Copy, Eq, Hash, PartialEq, PartialOrd)]\r\npub struct A\u003cT\u003e(T);\r\n\r\n#[derive(Clone, Copy, Eq, Hash, PartialEq, PartialOrd)]\r\npub struct B\u003cT\u003e {\r\n    pub value: T,\r\n}\r\n\r\nfmt_wrapper! {\r\n    impl A\u003cT\u003e {\r\n        Debug,\r\n        Display,\r\n        LowerHex,\r\n        UpperHex,\r\n        LowerExp,\r\n        UpperExp,\r\n        Binary,\r\n        Octal,\r\n        Pointer,\r\n    }\r\n}\r\n\r\nfmt_wrapper! {\r\n    impl B\u003cT\u003e.value {\r\n        Debug,\r\n        Display,\r\n        LowerHex,\r\n        UpperHex,\r\n        LowerExp,\r\n        UpperExp,\r\n        Binary,\r\n        Octal,\r\n        Pointer,\r\n    }\r\n}\r\n\r\nfn main() {\r\n    let a = A::new(255);\r\n    let b = B { value: 255 };\r\n    println!(\"A: {a:X}, B: {b:X}\");\r\n}\r\n```\r\n\r\n## Getting Started\r\n\r\nTo get started with `contained`, you can check out the [QUICKSTART.md](QUICKSTART.md) file, which provides a step-by-step guide on how to set up your development environment and start using the library.\r\n\r\n## License\r\n\r\nLicensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\r\n\r\n## Contribution\r\n\r\nContributions are welcome, however, ensure that you have read the [CONTRIBUTING.md](CONTRIBUTING.md) file before submitting a pull request.\r\n\r\n## Security\r\n\r\nFor any security vulnerabilities, please refer to the [SECURITY.md](SECURITY.md) file for guidance on how to report them.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffl03%2Fcontained","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffl03%2Fcontained","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffl03%2Fcontained/lists"}