Enable `no_std` support
mainTo use gpu-allocator in a no_std environment:
- Disable default features and enable the
hashbrownfeature in yourCargo.tomlto provide requiredHashcollections.
[dependencies]
gpu-allocator = { version = "0.28.0", default-features = false, features = ["hashbrown"] }Note: no_std support requires Rust 1.81 or higher due to dependencies on core::error::Error.
To support both std and no_std builds in a single workspace, you can define features in your Cargo.toml like this:
[features]
default = ["std", "other features"]
std = ["gpu-allocator/std"]
hashbrown = ["gpu-allocator/hashbrown"]
other_features = []
[dependencies]
gpu-allocator = { version = "0.28.0", default-features = false }[dependencies]
gpu-allocator = { version = "0.28.0", default-features = false, features = ["hashbrown", "other features"] }