{"id":17700572,"url":"https://github.com/cdown/funcfmt","last_synced_at":"2026-01-29T22:02:55.237Z","repository":{"id":150258978,"uuid":"622098182","full_name":"cdown/funcfmt","owner":"cdown","description":"A simple templating crate that allows passing in custom data to functions through function traits.","archived":false,"fork":false,"pushed_at":"2024-11-14T07:42:34.000Z","size":64,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T13:32:35.290Z","etag":null,"topics":["closure","closure-templates","formatter","formatting","function-template","rust","rust-lang","template","template-engine"],"latest_commit_sha":null,"homepage":"","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/cdown.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,"zenodo":null}},"created_at":"2023-04-01T05:36:58.000Z","updated_at":"2024-11-14T07:42:38.000Z","dependencies_parsed_at":"2024-05-18T05:26:42.355Z","dependency_job_id":"97da114a-620e-402e-ac94-0e7c173f9f74","html_url":"https://github.com/cdown/funcfmt","commit_stats":{"total_commits":89,"total_committers":1,"mean_commits":89.0,"dds":0.0,"last_synced_commit":"49f9e3aa1eef5d9c0c2e93a8e39a3aaa1b331065"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cdown/funcfmt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdown%2Ffuncfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdown%2Ffuncfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdown%2Ffuncfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdown%2Ffuncfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdown","download_url":"https://codeload.github.com/cdown/funcfmt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdown%2Ffuncfmt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28886881,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T21:06:44.224Z","status":"ssl_error","status_checked_at":"2026-01-29T21:06:42.160Z","response_time":59,"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":["closure","closure-templates","formatter","formatting","function-template","rust","rust-lang","template","template-engine"],"created_at":"2024-10-24T17:42:33.476Z","updated_at":"2026-01-29T22:02:55.220Z","avatar_url":"https://github.com/cdown.png","language":"Rust","readme":"# funcfmt | [![Tests](https://img.shields.io/github/actions/workflow/status/cdown/funcfmt/ci.yml?branch=master)](https://github.com/cdown/funcfmt/actions?query=branch%3Amaster)\n\nfuncfmt is a simple, lightweight templating library that allows templating\nusing custom runtime context and function traits. It was originally created\nfor [exifrename](https://github.com/cdown/exifrename), to allow efficiently\nprocessing a format and set of callbacks across thousands of EXIF objects.\n\n## Documentation\n\nDocumentation is available on [docs.rs](https://docs.rs/funcfmt), or through\n`cargo doc --open`.\n\n## Usage\n\nTo add funcfmt to your dependencies:\n\n```\ncargo add funcfmt\n```\n\nThe basic flow of funcfmt looks like this:\n\n1. Given a `FormatMap\u003cT\u003e` called `formatters`, call\n   `formatters.to_format_pieces()`, which preprocesses everything into a\n   `FormatPieces\u003cT\u003e`, where `\u0026T` is what your callback function will take as\n   its only argument. This allows avoiding having to reparse the formatters and\n   go through the template each time things are processed.\n2. Call .render(data) on the `FormatPieces\u003cT\u003e`.\n\nA very small example with `String`s passed in, although you can pass an object\nof any type:\n\n```rust\nuse funcfmt::{fm, FormatMap, Render, ToFormatPieces};\n\nfn main() {\n    let formatters = FormatMap::from([\n        fm!(\"foo\", |data| Some(format!(\"foo: {data}\"))),\n        fm!(\"bar\", |data| Some(format!(\"bar: {data}\"))),\n        fm!(\"baz\", |data| Some(format!(\"baz: {data}\"))),\n    ]);\n\n    let fp = formatters.to_format_pieces(\"{foo}, {bar}\").unwrap();\n\n    // foo: some data, bar: some data\n    let data_one = String::from(\"some data\");\n    println!(\"{}\", fp.render(\u0026data_one).unwrap());\n\n    // foo: other data, bar: other data\n    // note that this doesn't require processing the format again\n    let data_two = String::from(\"other data\");\n    println!(\"{}\", fp.render(\u0026data_two).unwrap());\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdown%2Ffuncfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdown%2Ffuncfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdown%2Ffuncfmt/lists"}