Skip to content

Commit ecdfada

Browse files
committed
Fix docs
1 parent a5fd165 commit ecdfada

File tree

4 files changed

+11
-34
lines changed

4 files changed

+11
-34
lines changed

README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ To use the `entrypoint!` macro, use the following in your entrypoint definition:
7070
use pinocchio::{
7171
account::AccountView,
7272
entrypoint,
73-
msg,
7473
ProgramResult,
7574
Address
7675
};
@@ -82,7 +81,6 @@ pub fn process_instruction(
8281
accounts: &[AccountView],
8382
instruction_data: &[u8],
8483
) -> ProgramResult {
85-
msg!("Hello from my program!");
8684
Ok(())
8785
}
8886
```
@@ -114,7 +112,6 @@ use pinocchio::{
114112
default_panic_handler,
115113
entrypoint::InstructionContext,
116114
lazy_program_entrypoint,
117-
msg,
118115
ProgramResult
119116
};
120117

@@ -125,7 +122,6 @@ default_panic_handler!();
125122
pub fn process_instruction(
126123
mut context: InstructionContext
127124
) -> ProgramResult {
128-
msg!("Hello from my lazy program!");
129125
Ok(())
130126
}
131127
```
@@ -149,7 +145,6 @@ To use the `no_allocator!` macro, use the following in your entrypoint definitio
149145
use pinocchio::{
150146
account::AccountView,
151147
default_panic_handler,
152-
msg,
153148
no_allocator,
154149
program_entrypoint,
155150
ProgramResult,
@@ -165,7 +160,6 @@ pub fn process_instruction(
165160
accounts: &[AccountView],
166161
instruction_data: &[u8],
167162
) -> ProgramResult {
168-
msg!("Hello from `no_std` program!");
169163
Ok(())
170164
}
171165
```
@@ -174,13 +168,15 @@ pub fn process_instruction(
174168
175169
## Crate feature: `std`
176170

177-
By default, `pinocchio` is a `no_std` crate. This means that it does not use any code from the standard (`std`) library. While this does not affect how `pinocchio` is used, there is one particular apparent difference. In a `no_std` environment, the `msg!` macro does not provide any formatting options since the `format!` macro requires the `std` library. In order to use `msg!` with formatting, the `std` feature should be enabled when adding `pinocchio` as a dependency:
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 `std` feature must be enabled when adding
175+
Pinocchio as a dependency:
178176
```
179-
pinocchio = { version = "0.7.0", features = ["std"] }
177+
pinocchio = { version = "0.10.0", features = ["std"] }
180178
```
181179

182-
Instead of enabling the `std` feature to be able to format log messages with `msg!`, it is recommended to use the [`pinocchio-log`](https://crates.io/crates/pinocchio-log) crate. This crate provides a lightweight `log!` macro with better compute units consumption than the standard `format!` macro without requiring the `std` library.
183-
184180
## Advance entrypoint configuration
185181

186182
The symbols emitted by the entrypoint macros — program entrypoint, global allocator and default panic handler — can only be defined once globally. If the program crate is also intended to be used as a library, it is common practice to define a Cargo [feature](https://doc.rust-lang.org/cargo/reference/features.html) in your program crate to conditionally enable the module that includes the `entrypoint!` macro invocation. The convention is to name the feature `bpf-entrypoint`.
@@ -191,7 +187,6 @@ mod entrypoint {
191187
use pinocchio::{
192188
account::AccountView,
193189
entrypoint,
194-
msg,
195190
ProgramResult,
196191
Address
197192
};
@@ -203,7 +198,6 @@ mod entrypoint {
203198
accounts: &[AccountView],
204199
instruction_data: &[u8],
205200
) -> ProgramResult {
206-
msg!("Hello from my program!");
207201
Ok(())
208202
}
209203
}

sdk/pinocchio/src/entrypoint/lazy.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ macro_rules! lazy_entrypoint {
6262
/// default_panic_handler,
6363
/// entrypoint::InstructionContext,
6464
/// lazy_program_entrypoint,
65-
/// msg,
6665
/// ProgramResult
6766
/// };
6867
///
@@ -73,7 +72,6 @@ macro_rules! lazy_entrypoint {
7372
/// pub fn process_instruction(
7473
/// mut context: InstructionContext,
7574
/// ) -> ProgramResult {
76-
/// msg!("Hello from my `lazy` program!");
7775
/// Ok(())
7876
/// }
7977
///

sdk/pinocchio/src/entrypoint/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ const STATIC_ACCOUNT_DATA: usize = size_of::<Account>() + MAX_PERMITTED_DATA_INC
9494
/// use pinocchio::{
9595
/// AccountView,
9696
/// entrypoint,
97-
/// msg,
9897
/// Address,
9998
/// ProgramResult
10099
/// };
@@ -106,7 +105,6 @@ const STATIC_ACCOUNT_DATA: usize = size_of::<Account>() + MAX_PERMITTED_DATA_INC
106105
/// accounts: &[AccountView],
107106
/// instruction_data: &[u8],
108107
/// ) -> ProgramResult {
109-
/// msg!("Hello from my program!");
110108
/// Ok(())
111109
/// }
112110
///

sdk/pinocchio/src/lib.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
//! AccountView,
3737
//! Address,
3838
//! entrypoint,
39-
//! msg,
4039
//! ProgramResult
4140
//! };
4241
//!
@@ -47,7 +46,6 @@
4746
//! accounts: &[AccountView],
4847
//! instruction_data: &[u8],
4948
//! ) -> ProgramResult {
50-
//! msg!("Hello from my program!");
5149
//! Ok(())
5250
//! }
5351
//! ```
@@ -97,7 +95,6 @@
9795
//! default_panic_handler,
9896
//! entrypoint::InstructionContext,
9997
//! lazy_program_entrypoint,
100-
//! msg,
10198
//! ProgramResult
10299
//! };
103100
//!
@@ -108,7 +105,6 @@
108105
//! pub fn process_instruction(
109106
//! mut context: InstructionContext
110107
//! ) -> ProgramResult {
111-
//! msg!("Hello from my lazy program!");
112108
//! Ok(())
113109
//! }
114110
//! ```
@@ -142,7 +138,6 @@
142138
//! AccountView,
143139
//! Address,
144140
//! default_panic_handler,
145-
//! msg,
146141
//! no_allocator,
147142
//! program_entrypoint,
148143
//! ProgramResult
@@ -157,7 +152,6 @@
157152
//! accounts: &[AccountView],
158153
//! instruction_data: &[u8],
159154
//! ) -> ProgramResult {
160-
//! msg!("Hello from `no_std` program!");
161155
//! Ok(())
162156
//! }
163157
//! ```
@@ -170,19 +164,14 @@
170164
//!
171165
//! By default, Pinocchio is a `no_std` crate. This means that it does not use any
172166
//! code from the standard (`std`) library. While this does not affect how Pinocchio
173-
//! is used, there is a one particular apparent difference. In a `no_std` environment,
174-
//! the [`msg!`] macro does not provide any formatting options since the `format!` macro
175-
//! requires the `std` library. In order to use [`msg!`] with formatting, the `std`
176-
//! feature should be enable when adding Pinocchio as a dependency:
167+
//! is used, there is a one particular apparent difference. Helpers that need to
168+
//! allocate memory, such as fetching `SlotHashes` sysvar, are not available. To
169+
//! enable these helpers, the `std` feature must be enabled when adding Pinocchio
170+
//! as a dependency:
177171
//! ```ignore
178-
//! pinocchio = { version = "0.7.0", features = ["std"] }
172+
//! pinocchio = { version = "0.10.0", features = ["std"] }
179173
//! ```
180174
//!
181-
//! Instead of enabling the `std` feature to be able to format log messages with [`msg!`],
182-
//! it is recommended to use the [`pinocchio-log`](https://crates.io/crates/pinocchio-log)
183-
//! crate. This crate provides a lightweight `log!` macro with better compute units
184-
//! consumption than the standard `format!` macro without requiring the `std` library.
185-
//!
186175
//! ## Advanced entrypoint configuration
187176
//!
188177
//! The symbols emitted by the entrypoint macros - program entrypoint, global
@@ -199,7 +188,6 @@
199188
//! AccountView,
200189
//! Address,
201190
//! entrypoint,
202-
//! msg,
203191
//! ProgramResult
204192
//! };
205193
//!
@@ -210,7 +198,6 @@
210198
//! accounts: &[AccountView],
211199
//! instruction_data: &[u8],
212200
//! ) -> ProgramResult {
213-
//! msg!("Hello from my program!");
214201
//! Ok(())
215202
//! }
216203
//! }

0 commit comments

Comments
 (0)