Secure allocation containers with automatic zeroization.
This crate provides four main types:
- [
AllockedVec]: Capacity-locked Vec with fallible operations - [
RedoubtArray]: Fixed-size array with automatic zeroization - [
RedoubtVec]: Auto-growing Vec with safe reallocation (2x growth) - [
RedoubtString]: Auto-growing String with safe reallocation (2x growth)
Core Guarantees
- Controlled capacity: Once sealed with
reserve_exact(), that method cannot be called again. To change capacity, userealloc_with_capacity()which safely zeroizes the old allocation before creating a new one. - Automatic zeroization: All data is zeroized on drop via
#[fast_zeroize(drop)] - Fallible operations:
push()andreserve_exact()fail instead of reallocating, preventing unintended copies of data
Example: Basic Usage
use ;
# example.unwrap;
Example: Controlled Reallocation
use ;
# example.unwrap;
Test Utilities
Enable the test-utils feature to inject failures for testing error handling paths:
[]
= { = "*", = ["test-utils"] }
Then use [AllockedVecBehaviour] to test error scenarios:
// test-utils feature required in dev-dependencies
License
GPL-3.0-only