{"id":13648778,"url":"https://github.com/mozillazg/rust-pinyin","last_synced_at":"2025-06-26T03:04:08.690Z","repository":{"id":32945142,"uuid":"36541341","full_name":"mozillazg/rust-pinyin","owner":"mozillazg","description":"汉字转拼音","archived":false,"fork":false,"pushed_at":"2023-05-23T14:36:03.000Z","size":5055,"stargazers_count":213,"open_issues_count":10,"forks_count":25,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-23T10:52:28.768Z","etag":null,"topics":["chinese","hanzi","hanzi-pinyin","pinyin","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/pinyin/","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/mozillazg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2015-05-30T03:26:12.000Z","updated_at":"2025-05-30T07:31:26.000Z","dependencies_parsed_at":"2024-01-14T10:59:37.348Z","dependency_job_id":"c4cc5393-b3f8-4f3d-bd4a-d1777cee1a1f","html_url":"https://github.com/mozillazg/rust-pinyin","commit_stats":{"total_commits":169,"total_committers":8,"mean_commits":21.125,"dds":0.5562130177514792,"last_synced_commit":"37263f507124eb4a537eb248b2d3c89dfb541b2e"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/mozillazg/rust-pinyin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozillazg%2Frust-pinyin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozillazg%2Frust-pinyin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozillazg%2Frust-pinyin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozillazg%2Frust-pinyin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mozillazg","download_url":"https://codeload.github.com/mozillazg/rust-pinyin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozillazg%2Frust-pinyin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261990350,"owners_count":23241187,"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":["chinese","hanzi","hanzi-pinyin","pinyin","rust"],"created_at":"2024-08-02T01:04:32.070Z","updated_at":"2025-06-26T03:04:08.666Z","avatar_url":"https://github.com/mozillazg.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# rust-pinyin\n\n[![Build Status](https://github.com/mozillazg/rust-pinyin/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/mozillazg/rust-pinyin/actions/workflows/ci.yml)\n[![Crates.io Version](https://img.shields.io/crates/v/pinyin.svg)](https://crates.io/crates/pinyin)\n[![Doc](https://img.shields.io/badge/doc-reference-blue.svg)](https://docs.rs/pinyin/)\n\u003c!-- [![Coverage Status](https://img.shields.io/coveralls/mozillazg/rust-pinyin/master.svg)](https://coveralls.io/github/mozillazg/rust-pinyin) --\u003e\n\n汉语拼音转换工具 Rust 版\n\n\nInstallation\n------------\n\nAdd this to your `Cargo.toml`:\n\n```\n[dependencies]\npinyin = \"0.10\"\n```\n\n\nDocumentation\n--------------\n\nAPI documentation can be found here: https://docs.rs/pinyin/\n\n\nUsage\n------\n\n```rust\nuse pinyin::{ToPinyin, ToPinyinMulti};\n\nfn main() {\n    let hans = \"中国人\";\n\n    // 无声调，输出 zhong guo ren\n    for pinyin in hans.to_pinyin() {\n        if let Some(pinyin) = pinyin {\n            print!(\"{} \", pinyin.plain());\n        }\n    }\n    println!();\n\n    // 包含声调，输出 zhōng guó rén\n    for pinyin in hans.to_pinyin() {\n        if let Some(pinyin) = pinyin {\n            print!(\"{} \", pinyin.with_tone());\n        }\n    }\n    println!();\n\n    // 声调用数字表示，输出 zho1ng guo2 re2n\n    for pinyin in hans.to_pinyin() {\n        if let Some(pinyin) = pinyin {\n            print!(\"{} \", pinyin.with_tone_num());\n        }\n    }\n    println!();\n\n    // 多音字，输出\n    // zho1ng zho4ng\n    // guo2\n    // re2n\n    for multi in hans.to_pinyin_multi() {\n        if let Some(multi) = multi {\n            for pinyin in multi {\n                print!(\"{} \", pinyin.with_tone_num());\n            }\n            println!();\n        }\n    }\n}\n```\n\n\nBuild\n------------\n\n```\n$ cargo build\n```\n\nTest\n------------\n\n```\n$ cargo test\n```\n\nData\n-----\n\n使用来自 [pinyin-data](https://github.com/mozillazg/pinyin-data) 的拼音数据。\n\n\nRelated Projects\n-----------------\n\n* [hotoo/pinyin](https://github.com/hotoo/pinyin): 汉语拼音转换工具 Node.js/JavaScript 版。\n* [mozillazg/python-pinyin](https://github.com/mozillazg/python-pinyin): 汉语拼音转换工具 Python 版。\n* [mozillazg/go-pinyin](https://github.com/mozillazg/go-pinyin): 汉语拼音转换工具 Go 版。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozillazg%2Frust-pinyin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmozillazg%2Frust-pinyin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozillazg%2Frust-pinyin/lists"}