{"id":20983852,"url":"https://github.com/danaugrs/overload","last_synced_at":"2025-04-06T10:12:52.814Z","repository":{"id":35057226,"uuid":"200891873","full_name":"danaugrs/overload","owner":"danaugrs","description":"Simplified operator overloading in Rust","archived":false,"fork":false,"pushed_at":"2024-11-10T14:09:01.000Z","size":31,"stargazers_count":16,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T17:43:42.943Z","etag":null,"topics":["macros","operator","operator-overloading","rust"],"latest_commit_sha":null,"homepage":null,"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/danaugrs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-06T16:59:07.000Z","updated_at":"2025-02-20T17:50:31.000Z","dependencies_parsed_at":"2024-12-24T01:08:53.148Z","dependency_job_id":"4827897b-8af1-4795-8340-19288458e18c","html_url":"https://github.com/danaugrs/overload","commit_stats":{"total_commits":10,"total_committers":2,"mean_commits":5.0,"dds":0.09999999999999998,"last_synced_commit":"1237489f88003a942dd3a4611f63c75eef8072da"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danaugrs%2Foverload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danaugrs%2Foverload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danaugrs%2Foverload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danaugrs%2Foverload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danaugrs","download_url":"https://codeload.github.com/danaugrs/overload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464222,"owners_count":20942970,"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":["macros","operator","operator-overloading","rust"],"created_at":"2024-11-19T05:50:30.988Z","updated_at":"2025-04-06T10:12:52.783Z","avatar_url":"https://github.com/danaugrs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg width=\"460\" src=\"https://github.com/danaugrs/overload/blob/master/logo.png\"\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://docs.rs/overload\"\u003e\u003cimg src=\"https://docs.rs/overload/badge.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://crates.io/crates/overload\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/overload.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nProvides a macro to simplify operator overloading. See the [documentation](https://docs.rs/overload/) for details and supported operators.\n\n## Example\n\n```rust\nextern crate overload;\nuse overload::overload;\n\n#[derive(PartialEq, Debug)]\nstruct Val {\n    v: i32\n}\n\noverload!((a: ?Val) + (b: ?Val) -\u003e Val { Val { v: a.v + b.v } });\n```\n\nThe macro call in the snippet above generates the following code:\n\n```rust\nimpl std::ops::Add\u003cVal\u003e for Val {\n    type Output = Val;\n    fn add(self, b: Val) -\u003e Self::Output {\n        let a = self;\n        Val { v: a.v + b.v }\n    }\n}\nimpl std::ops::Add\u003c\u0026Val\u003e for Val {\n    type Output = Val;\n    fn add(self, b: \u0026Val) -\u003e Self::Output {\n        let a = self;\n        Val { v: a.v + b.v }\n    }\n}\nimpl std::ops::Add\u003cVal\u003e for \u0026Val {\n    type Output = Val;\n    fn add(self, b: Val) -\u003e Self::Output {\n        let a = self;\n        Val { v: a.v + b.v }\n    }\n}\nimpl std::ops::Add\u003c\u0026Val\u003e for \u0026Val {\n    type Output = Val;\n    fn add(self, b: \u0026Val) -\u003e Self::Output {\n        let a = self;\n        Val { v: a.v + b.v }\n    }\n}\n``` \n\nWe are now able to add `Val`s and `\u0026Val`s in any combination:\n\n```rust\nassert_eq!(Val{v:3} + Val{v:5}, Val{v:8});\nassert_eq!(Val{v:3} + \u0026Val{v:5}, Val{v:8});\nassert_eq!(\u0026Val{v:3} + Val{v:5}, Val{v:8});\nassert_eq!(\u0026Val{v:3} + \u0026Val{v:5}, Val{v:8});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanaugrs%2Foverload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanaugrs%2Foverload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanaugrs%2Foverload/lists"}