A Rust library providing a stack-like dynamic memory pool with double-ended allocation support.
Features include:
no_std
usage.Add this to your Cargo.toml
:
toml
[dependencies]
scratchpad = "0.2"
and this to your crate root:
```rust
extern crate scratchpad; ```
The minimum supported Rust version is 1.25 due to use of the repr(align)
attribute.
no_std
Supportscratchpad
doesn't require the Rust standard library, although it makes use
of it by default (via the std
crate feature) to provide support for using
Box
as backing memory. For no_std
support, the std
feature must be
disabled in your Cargo.toml
:
toml
[dependencies]
scratchpad = { version = "0.2", default-features = false }
Box
support is still available for no_std
builds when using a nightly
toolchain by enabling the unstable
crate feature.
The unstable
crate feature provides some additional functionality when using
a nightly toolchain:
ByteData
trait implementations for u128
/i128
.Scratchpad::new()
as const
, allowing it to
be used directly to initialize static variables (lazy_static
crate or
similar workaround needed otherwise).Box
as the storage type for allocations and marker
tracking, regardless of whether the std
feature is enabled (alloc
library is used if std
is disabled).Simply add the unstable
feature to your Cargo.toml
dependency:
toml
[dependencies]
scratchpad = { version = "0.2", features = ["unstable"] }