sanitization-bytes 1.1.0

bytes::BytesMut integration wrappers for the sanitization crate.
Documentation
  • Coverage
  • 100%
    19 out of 19 items documented0 out of 15 items with examples
  • Size
  • Source code size: 10.4 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 267.26 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • valkyoth/sanitization-rust-crate
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • eldryoth

sanitization-bytes

Small bytes integration crate for sanitization.

The main sanitization crate stays dependency-free. This sister crate provides SecretBytesMut, a clear-on-drop wrapper around bytes::BytesMut for projects that already use bytes.

use sanitization_bytes::SecretBytesMut;

let mut token = SecretBytesMut::with_capacity(16);
token.extend_from_slice(b"session-token").unwrap();
token.extend_from_slice(b"-v2").unwrap();
token.clear_secret();

SecretBytesMut treats capacity as fixed after construction. Appending beyond capacity returns an error instead of reallocating, because implicit growth would free an old allocation that still contains secret bytes.