docs: 开源规范化 — doc comments + 社区文件 + 示例代码 + crates.io 就绪
- 为 core 公开 API 添加完整 doc comments(rustdoc 可用) - 新增 .editorconfig / CONTRIBUTING / CODE_OF_CONDUCT / SECURITY - 新增 Issue 模板(bug + feature)+ PR 模板 - 新增 3 个代码示例(examples/) - 更新 Cargo.toml 元数据(description/repository/keywords/categories/MSRV) - 更新 README + CHANGELOG
This commit is contained in:
@@ -5,13 +5,14 @@
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/version-0.1.0-blue" alt="version">
|
||||
<img src="https://img.shields.io/badge/rust-1.95-000000" alt="rust">
|
||||
<img src="https://img.shields.io/badge/tauri-2.x-ffa03a" alt="tauri">
|
||||
<img src="https://img.shields.io/badge/react-18-61dafb" alt="react">
|
||||
<img src="https://img.shields.io/badge/axum-0.8-ff6b35" alt="axum">
|
||||
<img src="https://img.shields.io/badge/rust-1.95-000000" alt="rust">
|
||||
<img src="https://img.shields.io/badge/docker-ready-2496ed" alt="docker">
|
||||
<img src="https://img.shields.io/badge/license-MIT-green" alt="license">
|
||||
<img src="https://img.shields.io/badge/tests-82%20passed-brightgreen" alt="tests">
|
||||
<img src="https://img.shields.io/badge/tests-58%20passed-brightgreen" alt="tests">
|
||||
<img src="https://img.shields.io/badge/clippy-clean-brightgreen" alt="clippy">
|
||||
</p>
|
||||
|
||||
---
|
||||
@@ -271,6 +272,48 @@ QRGen/
|
||||
| 自动版本选择 | 根据数据长度 + 纠错级别 |
|
||||
| Docker 镜像 | ~18MB (alpine) |
|
||||
|
||||
## 代码示例
|
||||
|
||||
`examples/` 目录包含三个示例:
|
||||
|
||||
```bash
|
||||
# 基础编码(默认配置)
|
||||
cargo run --example basic_qr
|
||||
|
||||
# 高纠错级别(H 级,30% 容错)
|
||||
cargo run --example high_ecc
|
||||
|
||||
# 自定义配置(固定版本 + 大尺寸 PNG)
|
||||
cargo run --example custom_config
|
||||
```
|
||||
|
||||
作为程序库使用:
|
||||
|
||||
```rust
|
||||
use qr_core::qr::{QrCode, QrConfig};
|
||||
|
||||
let qr = QrCode::encode("Hello QR!", QrConfig::default())?;
|
||||
println!("{}", qr.to_ascii(false)); // 终端预览
|
||||
qr.to_png_bytes(8)?; // PNG 字节
|
||||
let svg = qr.to_svg(); // SVG 字符串
|
||||
```
|
||||
|
||||
## 发布到 crates.io
|
||||
|
||||
`qr-core` 可作为 Rust 库被其他项目引用:
|
||||
|
||||
```bash
|
||||
cargo add qr-core
|
||||
```
|
||||
|
||||
## 社区
|
||||
|
||||
- [贡献指南](CONTRIBUTING.md) — 如何参与开发
|
||||
- [行为准则](CODE_OF_CONDUCT.md) — 社区规范
|
||||
- [安全策略](SECURITY.md) — 漏洞报告流程
|
||||
- [变更日志](CHANGELOG.md) — 版本历史
|
||||
- [Issue 模板](.github/ISSUE_TEMPLATE/) — Bug 报告 / 功能请求
|
||||
|
||||
## 许可证
|
||||
|
||||
MIT License
|
||||
|
||||
Reference in New Issue
Block a user