From f73579421525142cb31fd3b2325a1d1447b5fdab Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 22 Jun 2024 11:19:21 -0700 Subject: document `mod safer_unchecked` --- src/safer_unchecked.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/safer_unchecked.rs b/src/safer_unchecked.rs index 34216bc..b556a6f 100644 --- a/src/safer_unchecked.rs +++ b/src/safer_unchecked.rs @@ -1,3 +1,13 @@ +//! tools to help validate correct use of `unchecked` functions. +//! +//! these `kinda_unchecked` functions will use equivalent implementations that panic when +//! invariants are violated when the `debug_assertions` config is present, but use the +//! corresponding `*_unchecked` otherwise. +//! +//! for example, `GetSaferUnchecked` uses a normal index when debug assertions are enabled, but +//! `.get_unchecked()` otherwise. this means that tests and even fuzzing can be made to exercise +//! panic-on-error cases as desired. + use core::slice::SliceIndex; pub trait GetSaferUnchecked { -- cgit v1.1