{"id":13502873,"url":"https://github.com/dekirisu/strung","last_synced_at":"2025-09-15T18:50:48.372Z","repository":{"id":59169727,"uuid":"535720299","full_name":"dekirisu/strung","owner":"dekirisu","description":"Easy access of struct fields in strings using different/custom pre/postfix: \"Hello, {field}\" in rust","archived":false,"fork":false,"pushed_at":"2023-11-11T09:32:04.000Z","size":52,"stargazers_count":69,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-01T18:53:32.847Z","etag":null,"topics":["field","rust","string","string-formatter","string-manipulation","struct"],"latest_commit_sha":null,"homepage":"","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/dekirisu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-09-12T15:01:10.000Z","updated_at":"2025-06-17T10:19:21.000Z","dependencies_parsed_at":"2024-01-18T23:25:38.375Z","dependency_job_id":"e25669ca-1551-497b-8b4f-16a3d9db6356","html_url":"https://github.com/dekirisu/strung","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"5cde6246a445eecacdb83404a14ae9989849864f"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/dekirisu/strung","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekirisu%2Fstrung","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekirisu%2Fstrung/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekirisu%2Fstrung/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekirisu%2Fstrung/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dekirisu","download_url":"https://codeload.github.com/dekirisu/strung/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekirisu%2Fstrung/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275304908,"owners_count":25441168,"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","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["field","rust","string","string-formatter","string-manipulation","struct"],"created_at":"2024-07-31T22:02:27.885Z","updated_at":"2025-09-15T18:50:48.329Z","avatar_url":"https://github.com/dekirisu.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/78398528/282229773-1b280573-6efd-4604-a739-320b4ceb6ef3.gif\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/dekirisu/strung\" style=\"position:relative\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/github-dekirisu/strung-ee6677\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/strung\" style=\"position:relative\"\u003e\n        \u003cimg src=\"https://img.shields.io/crates/v/strung\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://docs.rs/strung\" style=\"position:relative\"\u003e\n        \u003cimg src=\"https://img.shields.io/docsrs/strung\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://discord.gg/kevWvBuPFg\" style=\"position:relative\"\u003e\n        \u003cimg src=\"https://img.shields.io/discord/515100001903312898\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Easy access to struct fields in strings\n🐠 add strung to the dependencies in the `Cargo.toml`:\n```toml\n[dependencies]\nstrung = \"0.1\"\n```\n🦀 use/import everything of the prelude in rust:\n```rust \nuse strung::prelude::*;\n```\n🦊 works for **unnamed** fields:\n```rust \n#[derive(Strung)]\nstruct Struct (\u0026'static str, u32);\nfn main(){\n    let s: String = Struct(\"Bob\", 10).strung(\"{0} is {1}th\"); \n}\n```\n🦊 works for **named** fields:\n```rust \n#[derive(Strung)]\nstruct Struct {\n    name: \u0026'static str,\n    pos: u32,\n}\nfn main(){\n    let s: String = Struct{name:\"Bob\", pos:10}.strung(\"{name} is {pos}th.\"); \n    // fields can also be addressed by their index\n    let z: String = Struct{name:\"Bob\", pos:10}.strung(\"{0} is {1}th.\"); \n}\n```\n## Ignore \n🐳 use `#[igno]`, `#[ignore]`,`#[strung(igno)]` or `#[strung(ignore)]` to make a field unavailable\u003cbr\u003e \n🦞 if a field type doesn't implement [Display](https://doc.rust-lang.org/std/fmt/trait.Display.html), it has to be ignored!\n```rust \nstruct NoDisplay;\n#[derive(Strung)]\nstruct Struct (\u0026'static str, u32, #[igno] NoDisplay);\nfn main(){\n    let s: String = Struct(\"Bob\", 10, NoDisplay)\n        .strung(\"{0} is {1}th, he won {2}!\"); \n}\n```\n## Cascade\n🐳 use `#[cscd]`, `#[cascade]`, `#[strung(cscd)]` or `#[strung(cascade)]` to cascade (recursion).\u003cbr\u003e\n🐑 cascaded fields are ignored by default \u003cbr\u003e\n🐔 use `#[notice]`, `#[ntce]` or inside `#[strung(..)]` to make them available, \n```rust \n#[derive(Strung)]\nstruct Struct \u0026'static str, u32);\n#[derive(Strung)]\nstruct Cascade (u32, #[cscd] Struct);\nfn main(){\n    let s: String = Cascade(11,Struct(\"Bob\", 10))\n        .strung(\"{1.0} is {1.1}th for the {0}th time!\"); \n    // =\u003e Bob is 10th for the 11th time!\n}\n```\n## Prefix and Postix Prefabs\n🐈 5 different prefabs are provided:\n```rust \n#[derive(Strung)]\nstruct Struct (\u0026'static str, u32);\nfn main(){\n    let t = Struct(\"Bob\", 10);\n    let s = t.strung_curly(\"{0} is {1}th.\"); \n    let s = t.strung_angle(\"\u003c0\u003e is \u003c1\u003eth.\"); \n    let s = t.strung_dollry(\"${0} is ${1}th.\"); \n    let s = t.strung_dollar(\"$0 is $1th.\"); \n    let s = t.strung_hashtag(\"#0 is #1th.\"); \n}\n```\n## Custom Prefix and Postix\n🦊 you can also customize pre-/postfixes in different ways\u003cbr\u003e\n🦅 **globally** - using static variables and `.strung_static(..)`:\n```rust \n#[derive(Strung)]\nstruct Struct (\u0026'static str, u32);\nfn main(){\n    strung::set_static(\"\u003c\",\"\u003e\");\n    let s: String = Struct(\"Bob\", 10).strung_static(\"\u003c0\u003e is \u003c1\u003eth.\"); \n}\n```\n🐎 **per struct** - this overrides the default `.strung(..)` pre/postfix:\n```rust \n#[derive(Strung)]\n#[strung(\"\u003c\",\"\u003e\")]\nstruct Struct (\u0026'static str, u32);\nfn main(){\n    let s: String = Struct(\"Bob\", 10).strung(\"\u003c0\u003e is \u003c1\u003eth.\"); \n}\n```\n🐍 **per call** - using parameters `.strung_dynamic(pre,post,..)`:\n```rust \n#[derive(Strung)]\nstruct Struct (\u0026'static str, u32);\nfn main(){\n    let s: String = Struct(\"Bob\", 10).strung_dynamic(\"\u003c\",\"\u003e\",\"\u003c0\u003e is \u003c1\u003eth.\"); \n}\n```\n🦎 **per call** - using generic const chars `.strung_generic::\u003cpre,post\u003e(..)`:\n```rust \n#[derive(Strung)]\nstruct Struct (\u0026'static str, u32);\nfn main(){\n    let s: String = Struct(\"Bob\", 10).strung_generic::\u003c'\u003c','\u003e'\u003e(\"\u003c0\u003e is \u003c1\u003eth.\"); \n}\n```\n## Performance Comparison\n🐕 dynamic/generic/global have equal runtime speed\u003cbr\u003e\n🐇 default/prefabs/per-struct are faster!\u003cbr\u003e\n🐁 Using a string of ~650 chracters and 6 field placeholders:\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/78398528/282233001-d68aaac4-d419-44fa-bc3d-3ae62eb22fe4.svg\"\u003e\n\u003c/p\u003e\n\n## More Information\n[🦕 Documentation](https://docs.rs/strung)\u003cbr\u003e\n\u003ca href=\"CHANGELOG.md\"\u003e🦎 Changelog\u003c/a\u003e\u003cbr\u003e\n[🐱 GitHub](https://github.com/dekirisu/strung)\u003cbr\u003e\n[👾 Discord Server](https://discord.gg/kevWvBuPFg)\u003cbr\u003e\n\n---\n### License\n\u003csup\u003e\nLicensed under either of \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version\n2.0\u003c/a\u003e or \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e at your option.\n\u003c/sup\u003e\n\u003cbr\u003e\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdekirisu%2Fstrung","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdekirisu%2Fstrung","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdekirisu%2Fstrung/lists"}