{"id":22736695,"url":"https://github.com/lianglliu/rust-iced-fetch-bitcoin","last_synced_at":"2026-05-18T06:03:23.065Z","repository":{"id":267516011,"uuid":"901493676","full_name":"LiangLliu/rust-iced-fetch-bitcoin","owner":"LiangLliu","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-20T14:48:43.000Z","size":333,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-20T15:47:21.103Z","etag":null,"topics":["iced","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LiangLliu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-12-10T19:00:37.000Z","updated_at":"2025-05-20T14:49:47.000Z","dependencies_parsed_at":"2025-03-25T07:45:36.071Z","dependency_job_id":null,"html_url":"https://github.com/LiangLliu/rust-iced-fetch-bitcoin","commit_stats":null,"previous_names":["lianglliu/rust-iced-fetch-bitcoin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LiangLliu/rust-iced-fetch-bitcoin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiangLliu%2Frust-iced-fetch-bitcoin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiangLliu%2Frust-iced-fetch-bitcoin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiangLliu%2Frust-iced-fetch-bitcoin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiangLliu%2Frust-iced-fetch-bitcoin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LiangLliu","download_url":"https://codeload.github.com/LiangLliu/rust-iced-fetch-bitcoin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiangLliu%2Frust-iced-fetch-bitcoin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278956004,"owners_count":26075220,"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-10-08T02:00:06.501Z","response_time":56,"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":["iced","rust"],"created_at":"2024-12-10T22:06:22.185Z","updated_at":"2026-05-18T06:03:23.045Z","avatar_url":"https://github.com/LiangLliu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitcoin Price Monitor\n\n基于 [Iced 0.14](https://github.com/iced-rs/iced) 的实时比特币价格监控桌面应用。\n\n![screenshot](./asserts/iced-fetch-bitcoin.png)\n\n## 功能\n\n- 实时获取 BTC 对 45 种法币价格（CoinGecko API）\n- 可配置自动刷新间隔\n- 11 种内置主题切换（Nord / Tokyo Night / Dracula …）\n- 多页面导航，页面状态保持\n- SVG 国旗并发下载\n- `tracing` 结构化日志\n\n## 快速开始\n\n```bash\ncargo run                                   # 默认 debug 日志\nRUST_LOG=iced_fetch_bitcoin=trace cargo run # trace 级别\ncargo build --release                       # 发布构建\n```\n\n## 项目结构\n\n```\nsrc/\n├── main.rs          # 入口：窗口配置、日志初始化\n├── app.rs           # App 状态、路由分发、subscription\n├── message.rs       # Message / BitcoinMessage / SettingsMessage / AboutMessage\n├── route.rs         # Route 枚举\n├── api.rs           # CoinGecko API + 错误处理 + debug 日志\n├── country.rs       # 45 国货币静态数据\n├── http_utils.rs    # 并发下载 SVG 国旗\n├── pages/           # 页面层（业务逻辑 + 状态）\n│   ├── bitcoin_page.rs\n│   ├── settings_page.rs\n│   └── about_page.rs\n└── views/           # 视图层（纯 UI 渲染）\n    ├── bitcoin_view.rs\n    ├── settings_view.rs\n    ├── about_view.rs\n    └── navigation.rs\n```\n\n## 架构\n\n采用 **App → Page → View** 三层分离 + Elm 风格消息驱动：\n\n```\nApp (路由 + 消息分发 + theme/subscription)\n ├── BitcoinPage  →  BitcoinView    # 价格展示\n ├── SettingsPage →  SettingsView   # 主题/刷新/通知\n └── AboutPage    →  AboutView      # 应用信息\n```\n\n**消息流**：用户操作 → `Message` → `App::update()` 分发到 Page → Page 返回 `Task` → 异步完成后回调。\n\n**关键设计**：\n- Settings 直接驱动 `App::theme()` 和 `App::subscription()`，修改立即生效\n- 页面切换只改 `current_route`，各页面状态保持不丢失\n- `iced::time::every` 实现可配置的自动刷新\n\n### 新增页面只需 3 步\n\n1. `route.rs` 加枚举值\n2. `message.rs` 加消息类型\n3. `pages/` + `views/` 各加一个文件，在 `app.rs` 中接入\n\n## 依赖\n\n| Crate | 用途 |\n|-------|------|\n| `iced 0.14` | GUI 框架 |\n| `reqwest` | HTTP 请求 |\n| `serde` / `serde_json` | JSON 序列化 |\n| `tokio` | 异步运行时 |\n| `futures` | 并发下载 |\n| `tracing` + `tracing-subscriber` | 结构化日志 |\n\n## 参考\n\n- [iced-rs/iced](https://github.com/iced-rs/iced)\n- [YouTube 教程](https://www.youtube.com/watch?v=Kmkz3_WwILk)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flianglliu%2Frust-iced-fetch-bitcoin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flianglliu%2Frust-iced-fetch-bitcoin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flianglliu%2Frust-iced-fetch-bitcoin/lists"}