std-ext
English | 简体中文
std-ext extends the Rust standard library with additional traits and utilities for common patterns, making standard types more convenient to use.
Features
ArcExttrait — wrap any value inArcvia.arc()AtomicExttrait — convert primitives to atomic typesCacheMapExt— TTL-based cache for HashMap, BTreeMap, DequeBTreeMap, DequeHashMapEntryExt— extended Entry API with TTL supportTimedValue— value wrapper with expirationOrdExt/HashExt/OrdHashExt— ordering and hashing wrappers- Tuple helper macros:
tuple_deref!,tuple_deref_mut!,tuple_take!
Cargo Feature Flags
This crate has no Cargo feature flags. All functionality is enabled by default.
Basic Usage
use ;
use Ordering;
// Wrap in Arc
let v = 42.arc;
assert_eq!;
// Convert to atomic
let a = 0usize.atomic;
a.store;
assert_eq!;
Tests
62 tests covering ArcExt, AtomicExt, CacheMapExt, EntryExt, TimedValue, and wrapper types.
License
Licensed under either of Apache License 2.0 or MIT license at your option.