Tinyvec
Just, really the littlest Vec you could need. So smol.
Install / Use
/learn @Lokathor/TinyvecREADME
tinyvec
A 100% safe crate of vec-like types.
Not just safe at the public API boundary, fully safe for all internal code too: #![forbid(unsafe_code)]
The provided types are as follows:
ArrayVecis an array-backed vec-like data structure. It panics on overflow.SliceVecis similar, but using a&mut [T]as the data backing.TinyVec(allocfeature) is an enum that's either anInline(ArrayVec)or aHeap(Vec). If aTinyVecisInlineand would overflow its array it automatically transitions toHeapand continues whatever it was doing.
To attain this "100% safe code" status there is one compromise: the element type of the vecs must implement Default.
For more API details, please see the docs.rs documentation
tinyvec Alternatives?
Maybe you don't want to use tinyvec, there's other crates you might use instead!
- arrayvec is a crate with array-backed structures.
- smallvec is a crate where the array-backed data can be moved to the heap on overflow.
The main difference is that both of those crates use unsafe code.
This mostly allows them to get rid of the Default limitation for elements that tinyvec imposes.
The smallvec and arrayvec crates are generally correct, but there's been occasional bugs leading to UB.
With tinyvec, any uncaught bugs can't lead to UB, because the crate is safe code all the way through.
If you want that absolute level of assurance against UB, use tinyvec.
Related Skills
himalaya
342.0kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
node-connect
342.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
coding-agent
342.0kDelegate coding tasks to Codex, Claude Code, or Pi agents via background process
