慣性聚合 高效追蹤和閱讀你感興趣的部落格、新聞、科技資訊
閱讀原文 在慣性聚合中打開

推薦訂閱源

Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
M
MIT News - Artificial intelligence
博客园 - 叶小钗
MyScale Blog
MyScale Blog
V
Visual Studio Blog
月光博客
月光博客
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
I
InfoQ
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
Jina AI
Jina AI
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Blog — PlanetScale
Blog — PlanetScale
Last Week in AI
Last Week in AI
雷峰网
雷峰网
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python)
GitHub rust-2026-template — 我在2026年的Rust起手模板
Dominik Oswa · 2026-05-25 · via DEV Community

我厭倦了每次新的 Rust 專案都要設定相同的事情。Clippy 設定檔、CI 管道、鏈接器旗標、pre-commit 鈎子,cargo-nextest... 每次都從頭開始。然後每次我切換 AI 編碼工具時都要再做一次重新解釋專案結構、靜態分析規則、什麼是不被允許的。

所以我就建立了rust-2026-template。點擊「使用此範本」,將您的代理指向它,您就開始編碼了——而不是進行設定.

這裡是實際包含的内容.


我最終總是得到這樣的設定

Rust 2024 版本,MSRV 1.87 通過 rust-toolchain.toml 固定。從第一天開始就有工作空間佈局——即使對於小型專案。後來將單一組件專案重构為工作空間只會帶來不必要的痛苦:

crates/
  example-crate/
  sample-app/

進入全螢幕模式 退出全螢幕模式

重新命名這些,完成


一個腳本,完整品質門檻

./scripts/quality-gates.sh

進入全螢幕模式 退出全螢幕模式

這執行 fmtclippy (嚴謹,零警告), cargo nextestcargo auditcargo deny,以及選擇性cargo mutants。相同的事情 CI 會執行。我會在每次提交前執行它,所以沒有驚喜。

使用 cargo-mutants 進行變異測試是我會推薦人們嘗試的——它告訴你你的測試是否真的 抓到錯誤,還是僅僅 觸及程式碼。非常不同的事情。


安全預設,不是後果

  • deny.toml — 授權政策及禁止的倉庫
  • .gitleaks.toml — 在任何提交之前進行機密掃描
  • .pre-commit-config.yaml — 錨頭在本地執行,不僅僅是在 CI 中

目標是讓你永遠不必記得要做這件事。它只是自動發生.


AI 代理開箱即用

這是目前我最常用的部分。每個 AI 編碼工具都需要專案背景資訊——而且它們都希望這些資訊放在稍微不同的位置。而不是每次會話都要重新解釋規範,所有這些都已經檢查進入:

.agents/      — skill definitions per agent
.claude/      — Claude Code config
.cursor/      — Cursor rules
.gemini/      — Gemini CLI config
.opencode/    — OpenCode config
.qwen/        — Qwen CLI config
.windsurf/    — Windsurf config
AGENTS.md     — canonical project rules, read by every agent
llms.txt      — machine-readable project overview

開啟全螢幕模式 關閉全螢幕模式

AGENTS.md 是關鍵文件。它告訴任何代理:工作空間佈局、靜態代碼分析規則、提交約定、什麼不應該觸碰。你在專案中從 Claude Code 切換到 Codex 再到 OpenCode — 他們都讀取相同的規則。無需重新認知。

當你從這個模板開始一個新專案時,你也可以直接把倉庫 URL 作為背景資訊交給你的代理:

"以 github.com/d-oit/rust-2026-template 作為此專案的參考。"

它會自動識別結構、工具選擇和慣例,而無需你為它們寫一個提示


你忘記添加的性能預設

.cargo/config.toml 設置了 mold �鏈接器。僅需一行代碼,顯著提升增量編譯速度。開發者配置文件已調整以避免「我的調試構建永無止境」的問題。這是個小細節,但在項目開發六個月後你會注意到它。


使用它

  1. 點擊 "使用此範本" 在 GitHub — 或者告訴你的代理:github.com/d-oit/rust-2026-template 作為此專案的參考
  2. 追蹤 QUICKSTART.md — 重新命名 the crates,更新 Cargo.toml
  3. 執行 ./scripts/quality-gates.sh 在本地一次

MIT 授權。歡迎貢獻 — 如果您總是在 Rust 專案中添加某個模式,請開啟一個問題。

github.com/d-oit/rust-2026-template