{"id":13629320,"url":"https://github.com/ufcpp/StringLiteralGenerator","last_synced_at":"2025-04-17T08:34:38.882Z","repository":{"id":41489969,"uuid":"271258646","full_name":"ufcpp/StringLiteralGenerator","owner":"ufcpp","description":"C# Source Generator for UTF-8 binary literal","archived":false,"fork":false,"pushed_at":"2024-09-04T00:00:05.000Z","size":61,"stargazers_count":140,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-07T13:21:35.834Z","etag":null,"topics":["csharp-sourcegenerator"],"latest_commit_sha":null,"homepage":"","language":"C#","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/ufcpp.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"ufcpp"}},"created_at":"2020-06-10T11:28:29.000Z","updated_at":"2025-03-29T00:15:52.000Z","dependencies_parsed_at":"2024-12-06T18:49:47.336Z","dependency_job_id":null,"html_url":"https://github.com/ufcpp/StringLiteralGenerator","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufcpp%2FStringLiteralGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufcpp%2FStringLiteralGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufcpp%2FStringLiteralGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufcpp%2FStringLiteralGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ufcpp","download_url":"https://codeload.github.com/ufcpp/StringLiteralGenerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249326186,"owners_count":21251735,"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":["csharp-sourcegenerator"],"created_at":"2024-08-01T22:01:07.363Z","updated_at":"2025-04-17T08:34:38.596Z","avatar_url":"https://github.com/ufcpp.png","language":"C#","readme":"# C# StringLiteralGenerator\n\nA C# [Source Generator](https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.md) for optimizing UTF-8 binaries.\n\nOriginal source (manually written):\n\n```cs\nnamespace Sample\n{\n    partial class Literals\n    {\n        [StringLiteral.Utf8Attribute(\"aαあ😊\")]\n        public static partial System.ReadOnlySpan\u003cbyte\u003e S();\n    }\n}\n```\n\nGenerated source:\n\n```cs\nnamespace Sample\n{\n    partial class Literals\n    {\n        public static partial System.ReadOnlySpan\u003cbyte\u003e S() =\u003e new byte[] {97, 206, 177, 227, 129, 130, 240, 159, 152, 138, };\n    }\n}\n```\n\n- Generates UTF-8 binary data from string literals (UTF-16).\n- The UTF-8 data is optimized to avoid allocation. see: [C# ReadOnlySpan and static data](https://vcsjones.dev/2019/02/01/csharp-readonly-span-bytes-static/)\n\n## NuGet\n\n[![NuGet](https://img.shields.io/nuget/v/StringLiteralGenerator?style=flat-square)](https://www.nuget.org/packages/StringLiteralGenerator)\n\n```xml\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\n\n    \u003cPropertyGroup\u003e\n        \u003cOutputType\u003eExe\u003c/OutputType\u003e\n        \u003cTargetFramework\u003enet5.0\u003c/TargetFramework\u003e\n    \u003c/PropertyGroup\u003e\n\n    \u003cItemGroup\u003e\n        \u003cPackageReference Include=\"StringLiteralGenerator\" Version=\"1.0.0\" /\u003e\n    \u003c/ItemGroup\u003e\n\n\u003c/Project\u003e\n```\n\nFor versions earlier than .NET 5 SDK RC2 you may also need to add a reference to `Microsoft.Net.Compilers.Toolset`.\nSo the `csproj` may look like this:\n```xml\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\n\n    \u003cPropertyGroup\u003e\n        \u003cOutputType\u003eExe\u003c/OutputType\u003e\n        \u003cTargetFramework\u003enet5.0\u003c/TargetFramework\u003e\n    \u003c/PropertyGroup\u003e\n\n    \u003cItemGroup\u003e\n        \u003cPackageReference Include=\"StringLiteralGenerator\" Version=\"1.0.0-preiew\" /\u003e\n        \u003cPackageReference Include=\"Microsoft.Net.Compilers.Toolset\" Version=\"3.8.0-4.final\" PrivateAssets=\"all\" /\u003e\n    \u003c/ItemGroup\u003e\n\n\u003c/Project\u003e\n```\n","funding_links":["https://github.com/sponsors/ufcpp"],"categories":["Content","Source Generators"],"sub_categories":["63. [StringLiteral](https://ignatandrei.github.io/RSCG_Examples/v2/docs/StringLiteral) , in the [Optimizer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#optimizer) category","Other"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufcpp%2FStringLiteralGenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fufcpp%2FStringLiteralGenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufcpp%2FStringLiteralGenerator/lists"}