Rewrap all comments to 100 line width (#9490)

* reformat everything again

* manual formatting

* last manual fix

* Fix build
This commit is contained in:
Kian Paimani
2021-08-11 16:56:55 +02:00
committed by GitHub
parent 8180c58700
commit abd08e29ce
258 changed files with 1776 additions and 1447 deletions
+40 -36
View File
@@ -60,9 +60,10 @@
//! `${TRAIT_NAME}_${FUNCTION_NAME}`. Such a function has the following signature
//! `(ptr: *u8, length: u32) -> u64`. It takes a pointer to an `u8` array and its length as an
//! argument. This `u8` array is expected to be the SCALE encoded parameters of the function as
//! defined in the trait. The return value is an `u64` that represents `length << 32 | pointer` of an
//! `u8` array. This return value `u8` array contains the SCALE encoded return value as defined by
//! the trait function. The macros take care to encode the parameters and to decode the return value.
//! defined in the trait. The return value is an `u64` that represents `length << 32 | pointer` of
//! an `u8` array. This return value `u8` array contains the SCALE encoded return value as defined
//! by the trait function. The macros take care to encode the parameters and to decode the return
//! value.
#![cfg_attr(not(feature = "std"), no_std)]
@@ -116,8 +117,9 @@ pub const MAX_EXTRINSIC_DEPTH: u32 = 256;
/// on the runtime side. The declaration for the runtime side is hidden in its own module.
/// The client side declaration gets two extra parameters per function,
/// `&self` and `at: &BlockId<Block>`. The runtime side declaration will match the given trait
/// declaration. Besides one exception, the macro adds an extra generic parameter `Block: BlockT`
/// to the client side and the runtime side. This generic parameter is usable by the user.
/// declaration. Besides one exception, the macro adds an extra generic parameter `Block:
/// BlockT` to the client side and the runtime side. This generic parameter is usable by the
/// user.
///
/// For implementing these macros you should use the
/// [`impl_runtime_apis!`] macro.
@@ -149,14 +151,14 @@ pub const MAX_EXTRINSIC_DEPTH: u32 = 256;
/// # Runtime api trait versioning
///
/// To support versioning of the traits, the macro supports the attribute `#[api_version(1)]`.
/// The attribute supports any `u32` as version. By default, each trait is at version `1`, if no
/// version is provided. We also support changing the signature of a method. This signature
/// change is highlighted with the `#[changed_in(2)]` attribute above a method. A method that is
/// tagged with this attribute is callable by the name `METHOD_before_version_VERSION`. This
/// method will only support calling into wasm, trying to call into native will fail (change the
/// spec version!). Such a method also does not need to be implemented in the runtime. It is
/// required that there exist the "default" of the method without the `#[changed_in(_)]` attribute,
/// this method will be used to call the current default implementation.
/// The attribute supports any `u32` as version. By default, each trait is at version `1`, if
/// no version is provided. We also support changing the signature of a method. This signature
/// change is highlighted with the `#[changed_in(2)]` attribute above a method. A method that
/// is tagged with this attribute is callable by the name `METHOD_before_version_VERSION`. This
/// method will only support calling into wasm, trying to call into native will fail (change
/// the spec version!). Such a method also does not need to be implemented in the runtime. It
/// is required that there exist the "default" of the method without the `#[changed_in(_)]`
/// attribute, this method will be used to call the current default implementation.
///
/// ```rust
/// sp_api::decl_runtime_apis! {
@@ -181,22 +183,23 @@ pub const MAX_EXTRINSIC_DEPTH: u32 = 256;
/// ```
///
/// To check if a given runtime implements a runtime api trait, the `RuntimeVersion` has the
/// function `has_api<A>()`. Also the `ApiExt` provides a function `has_api<A>(at: &BlockId)` to
/// check if the runtime at the given block id implements the requested runtime api trait.
/// function `has_api<A>()`. Also the `ApiExt` provides a function `has_api<A>(at: &BlockId)`
/// to check if the runtime at the given block id implements the requested runtime api trait.
pub use sp_api_proc_macro::decl_runtime_apis;
/// Tags given trait implementations as runtime apis.
///
/// All traits given to this macro, need to be declared with the
/// [`decl_runtime_apis!`](macro.decl_runtime_apis.html) macro. The implementation of the trait
/// should follow the declaration given to the [`decl_runtime_apis!`](macro.decl_runtime_apis.html)
/// macro, besides the `Block` type that is required as first generic parameter for each runtime
/// api trait. When implementing a runtime api trait, it is required that the trait is referenced
/// by a path, e.g. `impl my_trait::MyTrait for Runtime`. The macro will use this path to access
/// the declaration of the trait for the runtime side.
/// should follow the declaration given to the
/// [`decl_runtime_apis!`](macro.decl_runtime_apis.html) macro, besides the `Block` type that
/// is required as first generic parameter for each runtime api trait. When implementing a
/// runtime api trait, it is required that the trait is referenced by a path, e.g. `impl
/// my_trait::MyTrait for Runtime`. The macro will use this path to access the declaration of
/// the trait for the runtime side.
///
/// The macro also generates the api implementations for the client side and provides it through
/// the `RuntimeApi` type. The `RuntimeApi` is hidden behind a `feature` called `std`.
/// The macro also generates the api implementations for the client side and provides it
/// through the `RuntimeApi` type. The `RuntimeApi` is hidden behind a `feature` called `std`.
///
/// To expose version information about all implemented api traits, the constant
/// `RUNTIME_API_VERSIONS` is generated. This constant should be used to instantiate the `apis`
@@ -275,13 +278,13 @@ pub use sp_api_proc_macro::impl_runtime_apis;
/// Mocks given trait implementations as runtime apis.
///
/// Accepts similar syntax as [`impl_runtime_apis!`] and generates
/// simplified mock implementations of the given runtime apis. The difference in syntax is that the
/// trait does not need to be referenced by a qualified path, methods accept the `&self` parameter
/// and the error type can be specified as associated type. If no error type is specified [`String`]
/// is used as error type.
/// simplified mock implementations of the given runtime apis. The difference in syntax is that
/// the trait does not need to be referenced by a qualified path, methods accept the `&self`
/// parameter and the error type can be specified as associated type. If no error type is
/// specified [`String`] is used as error type.
///
/// Besides implementing the given traits, the [`Core`](sp_api::Core) and [`ApiExt`](sp_api::ApiExt)
/// are implemented automatically.
/// Besides implementing the given traits, the [`Core`](sp_api::Core) and
/// [`ApiExt`](sp_api::ApiExt) are implemented automatically.
///
/// # Example
///
@@ -329,14 +332,15 @@ pub use sp_api_proc_macro::impl_runtime_apis;
///
/// # `advanced` attribute
///
/// This attribute can be placed above individual function in the mock implementation to request
/// more control over the function declaration. From the client side each runtime api function is
/// called with the `at` parameter that is a [`BlockId`](sp_api::BlockId). When using the `advanced`
/// attribute, the macro expects that the first parameter of the function is this `at` parameter.
/// Besides that the macro also doesn't do the automatic return value rewrite, which means that full
/// return value must be specified. The full return value is constructed like
/// [`Result`]`<`[`NativeOrEncoded`](sp_api::NativeOrEncoded)`<ReturnValue>, Error>` while
/// `ReturnValue` being the return value that is specified in the trait declaration.
/// This attribute can be placed above individual function in the mock implementation to
/// request more control over the function declaration. From the client side each runtime api
/// function is called with the `at` parameter that is a [`BlockId`](sp_api::BlockId). When
/// using the `advanced` attribute, the macro expects that the first parameter of the function
/// is this `at` parameter. Besides that the macro also doesn't do the automatic return value
/// rewrite, which means that full return value must be specified. The full return value is
/// constructed like [`Result`]`<`[`NativeOrEncoded`](sp_api::NativeOrEncoded)`<ReturnValue>,
/// Error>` while `ReturnValue` being the return value that is specified in the trait
/// declaration.
///
/// ## Example
/// ```rust