Skip to content

Commit 2ac88ad

Browse files
committed
Update alloc feature description
1 parent b1e7a29 commit 2ac88ad

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,15 @@ pub fn process_instruction(
166166
> ⚠️ **Note:**
167167
> The `no_allocator!` macro can also be used in combination with the `lazy_program_entrypoint!`.
168168
169-
## Crate feature: `std`
169+
## Crate feature: `alloc`
170+
171+
The `alloc` feature is enabled by default and it uses the [`alloc`](https://doc.rust-lang.org/alloc/) crate. This provides access to dynamic memory allocation in combination with the `default_allocator`, e.g., required to use `String` and `Vec` in a program. Helpers that need to allocate memory, such as fetching `SlotHashes` sysvar data, are also available.
172+
173+
When no allocation is needed or desired, the feature can be disabled:
170174

171-
By default, Pinocchio is a `no_std` crate. This means that it does not use any code from the
172-
standard (`std`) library. While this does not affect how Pinocchio is used, there is a one
173-
particular apparent difference. Helpers that need to allocate memory, such as fetching `SlotHashes`
174-
sysvar data, are not available. To enable these helpers, the `alloc` feature must be enabled when
175-
adding Pinocchio as a dependency:
176175
```
177-
pinocchio = { version = "0.10.0", features = ["alloc"] }
176+
pinocchio = { version = "0.10.0", default-features = false }
178177
```
179-
The `alloc` feature uses the `alloc` crate.
180178

181179
## Advance entrypoint configuration
182180

0 commit comments

Comments
 (0)