{"id":21576370,"url":"https://github.com/sigurd4/fn_zip","last_synced_at":"2026-02-08T22:02:50.053Z","repository":{"id":178667602,"uuid":"662207281","full_name":"sigurd4/fn_zip","owner":"sigurd4","description":"Provides a zip trait for functions, allowing two functions to be combined at compile-time before being called.","archived":false,"fork":false,"pushed_at":"2025-06-23T16:37:17.000Z","size":44,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T17:02:48.874Z","etag":null,"topics":["fp","function","functional-programming","functions","join","lambda","no-std","no-std-alloc","rust","zip"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/fn_zip","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/sigurd4.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":"2023-07-04T15:30:53.000Z","updated_at":"2024-12-29T04:00:09.000Z","dependencies_parsed_at":"2024-12-29T05:26:59.331Z","dependency_job_id":null,"html_url":"https://github.com/sigurd4/fn_zip","commit_stats":null,"previous_names":["sigurd4/fn_zip"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sigurd4/fn_zip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Ffn_zip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Ffn_zip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Ffn_zip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Ffn_zip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigurd4","download_url":"https://codeload.github.com/sigurd4/fn_zip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigurd4%2Ffn_zip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29246439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T21:42:34.334Z","status":"ssl_error","status_checked_at":"2026-02-08T21:41:38.468Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["fp","function","functional-programming","functions","join","lambda","no-std","no-std-alloc","rust","zip"],"created_at":"2024-11-24T12:16:17.381Z","updated_at":"2026-02-08T22:02:50.030Z","avatar_url":"https://github.com/sigurd4.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status (nightly)](https://github.com/sigurd4/fn_zip/workflows/Build-nightly/badge.svg)](https://github.com/sigurd4/fn_zip/actions/workflows/build-nightly.yml)\n[![Build Status (nightly, all features)](https://github.com/sigurd4/fn_zip/workflows/Build-nightly-all-features/badge.svg)](https://github.com/sigurd4/fn_zip/actions/workflows/build-nightly-all-features.yml)\n\n[![Build Status (stable)](https://github.com/sigurd4/fn_zip/workflows/Build-stable/badge.svg)](https://github.com/sigurd4/fn_zip/actions/workflows/build-stable.yml)\n[![Build Status (stable, all features)](https://github.com/sigurd4/fn_zip/workflows/Build-stable-all-features/badge.svg)](https://github.com/sigurd4/fn_zip/actions/workflows/build-stable-all-features.yml)\n\n[![Test Status](https://github.com/sigurd4/fn_zip/workflows/Test/badge.svg)](https://github.com/sigurd4/fn_zip/actions/workflows/test.yml)\n[![Lint Status](https://github.com/sigurd4/fn_zip/workflows/Lint/badge.svg)](https://github.com/sigurd4/fn_zip/actions/workflows/lint.yml)\n\n[![Latest Version](https://img.shields.io/crates/v/fn_zip.svg)](https://crates.io/crates/fn_zip)\n[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Documentation](https://img.shields.io/docsrs/fn_zip)](https://docs.rs/fn_zip)\n[![Coverage Status](https://img.shields.io/codecov/c/github/sigurd4/fn_zip)](https://app.codecov.io/github/sigurd4/fn_zip)\n\n# fn_zip\n\nProvides a zip trait for functions, allowing two functions to be combined before being called. This is equivalent to `core::future::join!()`, but lazy, and works for non-async functions.\n\nThe resulting function takes the arguments of both functions and return a tuple.\n\n## Example\n\n```rust\nuse fn_zip::*;\n\nfn a(x: f32) -\u003e f64\n{\n    (x as f64).sqrt()\n}\nfn b(x: u8) -\u003e u8\n{\n    x + 1\n}\nlet ab = a.fn_zip(b); // (f32, u8) -\u003e (f64, u8)\n\nlet (x_a, x_b) = (4.0, 23);\nlet (y_a, y_b) = ab(x_a, x_b);\n\nassert_eq!(y_a, a(x_a));\nassert_eq!(y_b, b(x_b));\n```\n\n## Async\n\nThe zipped functions can also implement `AsyncFnOnce`, `AsyncFnMut` and `AsyncFn` if both functions qualify.\n\nThis is an experimental feature, since it just recently (as of writing) got added to the rust core library on rust-nightly, and may be subject to change at any point. Enable it with feature `async` or `experimental`.\n\n```rust\n#![feature(fn_traits)]\n#![feature(async_fn_traits)]\n\nuse fn_zip::*;\nuse core::ops::AsyncFn;\n\nasync fn a(x: f32) -\u003e f64\n{\n    (x as f64).sqrt()\n}\nasync fn b(x: u8) -\u003e u8\n{\n    x + 1\n}\n\nlet ab = a.fn_zip(b);\nlet (x_a, x_b) = (4.0, 23);\n\n// I don't know of any prettier way to call an async function...\n\nlet (y_a, y_b) = ab.async_call((x_a, x_b)).await;\n\nassert_eq!(y_a, a(x_a).await);\nassert_eq!(y_b, b(x_b).await);\n```\n\nIndependent of this feature, it's still possible to zip two asyncronous functions normally, but their futures will not be joined.\n\n## Compile time function zipping\n\nFunctions can also be zipped during compile-time.\n\n```rust\n#![feature(const_trait_impl)]\n\nuse fn_zip::*;\n\nfn a(x: f32) -\u003e f64\n{\n    (x as f64).sqrt()\n}\nfn b(x: u8) -\u003e u8\n{\n    x + 1\n}\n\n// Corce functions into function pointers\nconst A: fn(f32) -\u003e f64 = a;\nconst B: fn(u8) -\u003e u8 = b;\n\n// Zip during compile time\nconst AB: ZippedFn\u003c(f32,), (u8,), fn(f32) -\u003e f64, fn(u8) -\u003e u8\u003e = A.fn_zip_once(B);\n\nlet (x_a, x_b) = (4.0, 23);\nlet (y_a, y_b) = AB(x_a, x_b);\n\nassert_eq!(y_a, a(x_a));\nassert_eq!(y_b, b(x_b));\n```\n\n## Tuple sizes\n\nBy default, this crate operates with function pairs of up to 16 arguments combined, and splits them up in the form of tuples. If you want to use differently sized tuples, use the features `8`, `16`, `32`, `64`, `96`, `128`, `160`, `192`, `224` or `256` to set the maximum supported tuple size.\n\nThe `dont_hurt_yourself_by_using_all_features` is there to prevent usage of tuples bigger than 8 if `cargo` is ran with the flag `--all-features`. Using a tuple size above 16 is highly discouraged as it will make compilation time unbearably long. Compilation time will increase exponentially. You have been warned.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigurd4%2Ffn_zip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigurd4%2Ffn_zip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigurd4%2Ffn_zip/lists"}