mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-05 20:10:35 +00:00
This change provides a common convention for using allocator-dependent
features with:
#![cfg(feature = "alloc")]
When available, `Vec` is imported consistently as `prelude::Vec`, which
means modules that need access to `Vec` can simply do:
use prelude::*;
and if an allocator is available, `Vec` will be in the crate prelude.
This allows all `alloc` vs `std` gating to be handled in `lib.rs`,
`build.rs`, and `prelude.rs` so the rest of the codebase doesn't have to
do any gating whatsoever.
8 lines
227 B
Rust
8 lines
227 B
Rust
//! Crate-local prelude (for alloc-dependent features like `Vec`)
|
|
|
|
// TODO: switch to alloc::prelude
|
|
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
|
pub use alloc::vec::Vec;
|
|
|
|
#[cfg(feature = "std")]
|
|
pub use std::vec::Vec;
|