mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-11 08:07:21 +00:00
[contracts] Add docs generator for the contracts API to the #[define_env] macro (#13032)
* macro to expand traits for host functions documentation * other way: same Doc trait in seal modules * added docs for macro, and remove `doc` attribute * fmt * Apply suggestions from code review Co-authored-by: Alexander Theißen <alex.theissen@me.com> * make docs to be generated into re-exported `api_doc` module; fix unrelated elder docs; * make it compile without `doc` attr passed to macro * make alias functions indicated explicitly in docs * tidy up docs * refactored a bit * macro to auto-add doc warning for unstable functions * invoke macro with no doc generation by default * addressed review comments * hide api_doc module behind cfg(doc) Co-authored-by: Alexander Theißen <alex.theissen@me.com>
This commit is contained in:
@@ -28,6 +28,10 @@ pub use crate::wasm::{
|
||||
prepare::TryInstantiate,
|
||||
runtime::{CallFlags, Environment, ReturnCode, Runtime, RuntimeCosts},
|
||||
};
|
||||
|
||||
#[cfg(doc)]
|
||||
pub use crate::wasm::runtime::api_doc;
|
||||
|
||||
use crate::{
|
||||
exec::{ExecResult, Executable, ExportedFunction, Ext},
|
||||
gas::GasMeter,
|
||||
@@ -144,7 +148,7 @@ impl<T: Config> PrefabWasmModule<T> {
|
||||
/// Create the module by checking and instrumenting `original_code`.
|
||||
///
|
||||
/// This does **not** store the module. For this one need to either call [`Self::store`]
|
||||
/// or [`<Self as Executable>::execute`].
|
||||
/// or [`<Self as Executable>::execute`][`Executable::execute`].
|
||||
pub fn from_code(
|
||||
original_code: Vec<u8>,
|
||||
schedule: &Schedule<T>,
|
||||
@@ -164,7 +168,8 @@ impl<T: Config> PrefabWasmModule<T> {
|
||||
|
||||
/// Store the code without instantiating it.
|
||||
///
|
||||
/// Otherwise the code is stored when [`<Self as Executable>::execute`] is called.
|
||||
/// Otherwise the code is stored when [`<Self as Executable>::execute`][`Executable::execute`]
|
||||
/// is called.
|
||||
pub fn store(self) -> DispatchResult {
|
||||
code_cache::store(self, false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user