7 stable releases
| 1.2.0 | Mar 27, 2026 |
|---|---|
| 1.1.4 | Feb 18, 2026 |
| 1.1.3 | Feb 16, 2026 |
| 1.1.0 | Feb 6, 2026 |
| 1.0.0 | Jul 16, 2022 |
#672 in Encoding
200KB
709 lines
tampon[^1]
Specialized crate that contains SAFE Rust functions, macros and trait to serialize / deserialize data structure and/or object in packed bytes.
Version
1.2.0
- Removed optional max_size from [
deserialize_size!(...)] since exploit not possible anymore. - Modified Trait to remove optional max size.
1.1.4.
- All macros works without tokens.
1.1.3.
- Updated [
deserialize_size!(...)] to include optional max_size to prevent exploit. - Updated [
deserialize_size!(...)] and [deserialize!(...)] to accept no tokens.
1.1.0.
- Refactored faster macro code.
- Remove Tampon
<T>from Trait implementation. - Added function
deserialize_size()to trait Tampon. - Added
deserialize_size!(...)to get the real size of a buffer. - Added optional argument
optional_len_typefor maximum array size. - Updated rand crate.
1.0.0.
- Base version
Macros
buffer!(...) -> Vec<u8>- Variadic macro used to create abufferandserializecompatible variables.serialize!(...)- Variadic macro used toserializecompatible variablesinto abuffer.deserialize!(...)- Variadic macro used todeserializecompatible variablesfrom abuffer.bytes_size!(...) -> usize- Variadic macro used to get the size inbytesofcompatible variablestoserialize.deserialize_size!(...)Variadic macro used to get the size inbytesofcompatible variablesfrom buffer that return an error if buffer is too small.
Functions
generate_buffer(...) -> Vec<u8>- Generate a random buffer with specific size andcharset.wipe_buffer(...)- Wipe a sensible buffer to preventcold boot attackfor greater security.compare_buffer(...)- Compare 2 buffers and return theabsolute difference.
Trait
Tampon- Trait used toserialize / deserializeobject.
[^1]: Tampon means buffer in french.
Dependencies
~370KB