commit | 9dfef5cba3cb2fa6ed7af015e40e10f90428e386 | [log] [tgz] |
---|---|---|
author | Matthew Maurer <mmaurer@google.com> | Tue Mar 07 17:25:00 2023 -0800 |
committer | Matthew Maurer <mmaurer@google.com> | Tue Mar 07 17:25:00 2023 -0800 |
tree | b20f2866c1a76f13beb74f38d89e4f93290a0da8 | |
parent | 137c1e2ead287823878973bc767a30b727f143c4 [diff] |
Make tinyvec available to product and vendor Bug: 270690570 Test: mma in external/rust/crates Change-Id: I8fa6ccc67421b47796486e8ce213b8c96062a7f6
A 100% safe crate of vec-like types. #![forbid(unsafe_code)]
Main types are as follows:
ArrayVec
is an array-backed vec-like data structure. It panics on overflow.SliceVec
is the same deal, but using a &mut [T]
.TinyVec
(alloc
feature) is an enum that's either an Inline(ArrayVec)
or a Heap(Vec)
. If a TinyVec
is Inline
and would overflow it automatically transitions to Heap
and 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 details, please see the docs.rs documentation