Skip to content

Commit a18327e

Browse files
committed
Surround with complete contract code
1 parent 463fbc1 commit a18327e

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

crates/lang/src/env_access.rs

+21-6
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,33 @@ where
114114
/// # Example
115115
///
116116
/// ```
117+
/// #![cfg_attr(not(feature = "std"), no_std)]
118+
/// use ink_lang as ink;
117119
/// use ink_prelude;
118-
/// # use core::convert::TryFrom;
119-
/// # <ink_lang_ir::ItemImpl as TryFrom<syn::ItemImpl>>::try_from(syn::parse_quote! {
120+
/// # use ::ink_env::{
121+
/// # Environment,
122+
/// # DefaultEnvironment,
123+
/// # call::{build_create, Selector, ExecutionInput, FromAccountId}
124+
/// # };
125+
/// # #[ink::contract]
126+
/// # pub mod my_contract {
127+
/// # #[ink(storage)]
128+
/// # pub struct MyContract { }
129+
/// #
120130
/// # impl MyContract {
121-
/// #[ink(message)]
122-
/// pub fn call_me(&self) {
131+
/// # #[ink(constructor)]
132+
/// # pub fn new() -> Self {
133+
/// # Self {}
134+
/// # }
135+
///
136+
/// #[ink(message)]
137+
/// pub fn call_me(&self) {
123138
/// let caller = self.env().caller();
124139
/// let message = ink_prelude::format!("got a call from {:?}", caller);
125140
/// ink_env::debug_println(&message);
126-
/// }
141+
/// }
142+
/// # }
127143
/// # }
128-
/// # }).unwrap();
129144
/// ```
130145
///
131146
/// # Note

0 commit comments

Comments
 (0)