Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
VecStorage
Re-use the memory for vectors containing values with different lifetimes
In some situations, e.g. when writing real-time audio software, memory needs to be pre-allocated.
The Vec
data structure from Rust's standard library can be used for this purpose.
In some situations, however, you want to re-use the same Vec
for data that has different lifetimes
and Rust's type system doesn't allow this.
This crate intends to help you overcome this problem.
Example
The following code does not compile:
let mut v = Vec with_capacity;
You can use VecStorage
to solve this problem:
use VecStorage;
let mut v = with_capacity;
Documentation
See the documentation on docs.rs.
Related Crates
rsor
(short for "Reusable Slice Of References")
is developed to re-use the memory for containing references and can be used as an
alternative to vecstorage
if you want to store references.
rsor
has a different API that does not rely on run-time checks (in contrast to vecstorage
which does some runtime checks).
Contributing
We welcome contributions, both in the form of issues and in the form of pull requests. Before opening a pull request, please open an issue first so that you know whether a subsequent pull request would likely be approved. Alternatively, you can contribute via e-mail (an email address is in the commits).
It's best to run the automated tests before sending your contribution.
Testing
Since this crate uses some unsafe
blocks, we run the tests both "in a normal way" and under miri
.
Running the tests normally:
In order to run the tests under miri
, you need to
have the miri component installed.
Then you can run the tests under miri
as follows:
License
Vecstorage is distributed under the terms of the MIT license or the Apache License (Version 2.0), at your choice. For the application of the MIT license, the examples included in the doc comments are not considered "substatial portions of this Software".