Introduce alloc feature for optional allocation

Wrap heap-allocated types and service generation in the `alloc` feature
flag to support environments without a memory allocator.
This commit is contained in:
2026-05-19 21:55:18 -07:00
parent 6910f11d69
commit 117cbf812b
7 changed files with 201 additions and 52 deletions
+5
View File
@@ -1,5 +1,8 @@
#![no_std]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
@@ -438,6 +441,8 @@ impl<'a> Iterator for RawFieldIterator<'a> {
#[cfg(test)]
mod tests {
use super::*;
#[cfg(feature = "alloc")]
use alloc::{vec, vec::{Vec}};
#[test]
fn test_varint_read_write() {