Skip to content

A fixed-capacity vector type for Rust with just a single byte of overhead

License

Notifications You must be signed in to change notification settings

AlCalzone/tinyvec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinyvec

A fixed-capacity vector type for Rust with just a single byte of overhead. Supports a useful subset of Vec's API.

Usage

use tinyvec::TinyVec;

// Create a vector with up to 4 elements of type u8
let vec = TinyVec::<u8, 4>::new();
// push up to 4 elements
vec.push(1);
vec.push(2);
vec.push(3);
vec.push(4);
// this will panic:
vec.push(5);

Limitations

Stores at most 255 elements. Attempting to push when the vector is at capacity will result in a panic.

About

A fixed-capacity vector type for Rust with just a single byte of overhead

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages