diff options
author | iximeow <me@iximeow.net> | 2024-06-22 11:19:21 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2024-06-22 11:19:21 -0700 |
commit | f73579421525142cb31fd3b2325a1d1447b5fdab (patch) | |
tree | 3203601fcaa46da7a36f221f8718c25dabeb7bb8 /src | |
parent | a66be66c22bc31526ac35c1cffdb28992a392ccf (diff) |
document `mod safer_unchecked`
Diffstat (limited to 'src')
-rw-r--r-- | src/safer_unchecked.rs | 10 |
1 files changed, 10 insertions, 0 deletions
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<T> { |