transvec

Crates.iotransvec
lib.rstransvec
version0.3.7
sourcesrc
created_at2021-07-03 06:32:09.938462
updated_at2021-11-07 17:49:34.304288
descriptionA crate to safely transmute Vecs
homepage
repositoryhttps://github.com/frogtd/transvec
max_upload_size
id418117
size37,551
(frogtd)

documentation

README

transvec

transvec is a crate for transmuting Vecs without copying.

Installation

Add this to your Cargo.toml:

[dependencies]
transvec = "0.3"

Usage

use transvec::transmute_vec;
let input: Vec<u8> = vec![1, 2, 3, 4];
let output: Vec<u16, _> = transmute_vec(input).unwrap();

#![no_std]

This supports no_std, just disable the default features, and optionally enable allocator_api, which in addition requires atomic pointers. It does require alloc though.

Nightly

This is nightly because it's blocked on the allocator_api, which is how this crate can get around the aligment issue.

You can however turn off default features, and optionally enable std to make it work on stable, with the only options being transmute_vec_basic and transmute_vec_basic_may_copy.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Licenses

Commit count: 35

cargo fmt