视觉画布设计
canvas-design
基于设计原则创作静态视觉作品,用于海报与品牌图形。
rust-unsafe-boundaries【文档与办公】Isolate and review unsafe Rust behind small, documented, testable boundaries with explicit invariants. Use when writing, refactoring, or reviewing unsafe code, raw pointers, unsafe functions, unsafe traits, MaybeUninit, pointer aliasing, panic safety, Miri checks, or safe abstractions over unsafe internals.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill to isolate unsafe Rust behind small, documented, testable boundaries. Unsafe code is acceptable only when a safe API cannot express the needed operation with acceptable correctness and performance.
// SAFETY: comment immediately before each unsafe block explaining
why every unsafe operation inside is valid.unsafe fn only when callers must uphold extra conditions.
Document those conditions in a # Safety section.unsafe_op_in_unsafe_fn; unsafe operations inside unsafe
functions should still be wrapped in explicit unsafe blocks.Read references/safety-invariants.md before adding or approving unsafe code.
MaybeUninit<T> over deprecated or ad hoc uninitialized memory
patterns.set_len, pointer arithmetic, or from_raw_parts without proving
capacity, initialization, and ownership.static mut; prefer OnceLock, LazyLock, atomics, or locked state./// # Safety
///
/// `ptr` must be non-null, aligned for `T`, initialized, and valid for reads
/// for the returned lifetime. No mutable reference may alias the same value.
pub unsafe fn read_ref<'a, T>(ptr: *const T) -> &'a T {
// SAFETY: The caller guarantees `ptr` satisfies the documented contract.
unsafe { &*ptr }
}
SAFETY explanation.unsafe fn or unsafe trait has a # Safety contract.