{"id":15295191,"url":"https://github.com/jaemk/wrap","last_synced_at":"2026-02-13T11:24:15.016Z","repository":{"id":57672339,"uuid":"87375281","full_name":"jaemk/wrap","owner":"jaemk","description":"Rust wrapping macro","archived":false,"fork":false,"pushed_at":"2017-04-09T19:29:06.000Z","size":9,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T02:48:36.908Z","etag":null,"topics":["function-wrapper","rust","rustlang","wrap","wrapper"],"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/jaemk.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":"2017-04-06T02:04:08.000Z","updated_at":"2022-11-11T16:13:32.000Z","dependencies_parsed_at":"2022-08-31T01:24:29.146Z","dependency_job_id":null,"html_url":"https://github.com/jaemk/wrap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaemk%2Fwrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaemk%2Fwrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaemk%2Fwrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaemk%2Fwrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaemk","download_url":"https://codeload.github.com/jaemk/wrap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247436141,"owners_count":20938532,"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":["function-wrapper","rust","rustlang","wrap","wrapper"],"created_at":"2024-09-30T17:08:59.884Z","updated_at":"2026-02-13T11:24:14.969Z","avatar_url":"https://github.com/jaemk.png","language":"Rust","readme":"# wrap [![Build Status](https://travis-ci.org/jaemk/wrap.svg?branch=master)](https://travis-ci.org/jaemk/wrap) [![crates.io](https://img.shields.io/crates/v/wrap.svg)](https://crates.io/crates/wrap) [![docs](https://docs.rs/wrap/badge.svg)](https://docs.rs/wrap)\n\n\u003e generalized rust wrapping macro\n\nMacros for defining generalized `wrappers` and applying them to arbitrary functions. See `examples` for more advanced `wrappers`.\n\n## Simple Usage\n\n\n```rust,ignore\n#[macro_use] extern crate wrap;\n\n\ndef_wrapper!{log1 =\n    before = (fn_args) \u003e\u003e {\n        println!(\"* [log-1] \u003e\u003e before everything! fn_args: {:?}\", fn_args);\n    };\n    after  = (wrapped_result) \u003e\u003e {\n        println!(\"* [log-1] \u003e\u003e after everything! wrapped_result: {:?}\", wrapped_result);\n    };\n}\n\n\ndef_wrapper!{log2 =\n    before = (fn_args) \u003e\u003e {\n        println!(\"* [log-2] \u003e\u003e before everything! fn_args: {:?}\", fn_args);\n    };\n    after  = (wrapped_result) \u003e\u003e {\n        println!(\"* [log-2] \u003e\u003e after everything! wrapped_result: {:?}\", wrapped_result);\n    };\n}\n\n\nwrap_with!{log1 \u003e\u003e\nfn greet_logged_inner(name: \u0026str) -\u003e String = {\n    format!(\"How are you, {}?\", name)\n}}\n\n\nwrap_with!{log2 \u003e\u003e\nfn greet_logged(name: \u0026str) -\u003e String = {\n    format!(\"Hello! {}\", greet_logged_inner(name))\n}}\n\n\npub fn main() {\n    println!(\"{}\", greet_logged(\"james\"));\n}\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaemk%2Fwrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaemk%2Fwrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaemk%2Fwrap/lists"}