mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Rewrap all comments to 100 line width (#9490)
* reformat everything again * manual formatting * last manual fix * Fix build
This commit is contained in:
@@ -30,7 +30,8 @@ use sp_std::{
|
||||
ops::DerefMut,
|
||||
};
|
||||
|
||||
/// Marker trait for types that should be registered as [`Externalities`](crate::Externalities) extension.
|
||||
/// Marker trait for types that should be registered as [`Externalities`](crate::Externalities)
|
||||
/// extension.
|
||||
///
|
||||
/// As extensions are stored as `Box<Any>`, this trait should give more confidence that the correct
|
||||
/// type is registered and requested.
|
||||
@@ -95,7 +96,8 @@ macro_rules! decl_extension {
|
||||
///
|
||||
/// This is a super trait of the [`Externalities`](crate::Externalities).
|
||||
pub trait ExtensionStore {
|
||||
/// Tries to find a registered extension by the given `type_id` and returns it as a `&mut dyn Any`.
|
||||
/// Tries to find a registered extension by the given `type_id` and returns it as a `&mut dyn
|
||||
/// Any`.
|
||||
///
|
||||
/// It is advised to use [`ExternalitiesExt::extension`](crate::ExternalitiesExt::extension)
|
||||
/// instead of this function to get type system support and automatic type downcasting.
|
||||
|
||||
@@ -94,7 +94,8 @@ pub trait Externalities: ExtensionStore {
|
||||
self.place_storage(key.to_vec(), None);
|
||||
}
|
||||
|
||||
/// Clear a child storage entry (`key`) of current contract being called (effective immediately).
|
||||
/// Clear a child storage entry (`key`) of current contract being called (effective
|
||||
/// immediately).
|
||||
fn clear_child_storage(&mut self, child_info: &ChildInfo, key: &[u8]) {
|
||||
self.place_child_storage(child_info, key.to_vec(), None)
|
||||
}
|
||||
@@ -144,7 +145,8 @@ pub trait Externalities: ExtensionStore {
|
||||
limit: Option<u32>,
|
||||
) -> (bool, u32);
|
||||
|
||||
/// Set or clear a storage entry (`key`) of current contract being called (effective immediately).
|
||||
/// Set or clear a storage entry (`key`) of current contract being called (effective
|
||||
/// immediately).
|
||||
fn place_storage(&mut self, key: Vec<u8>, value: Option<Vec<u8>>);
|
||||
|
||||
/// Set or clear a child storage entry.
|
||||
@@ -167,7 +169,8 @@ pub trait Externalities: ExtensionStore {
|
||||
|
||||
/// Append storage item.
|
||||
///
|
||||
/// This assumes specific format of the storage item. Also there is no way to undo this operation.
|
||||
/// This assumes specific format of the storage item. Also there is no way to undo this
|
||||
/// operation.
|
||||
fn storage_append(&mut self, key: Vec<u8>, value: Vec<u8>);
|
||||
|
||||
/// Get the changes trie root of the current storage overlay at a block with given `parent`.
|
||||
|
||||
@@ -21,9 +21,9 @@ use crate::Externalities;
|
||||
|
||||
environmental::environmental!(ext: trait Externalities);
|
||||
|
||||
/// Set the given externalities while executing the given closure. To get access to the externalities
|
||||
/// while executing the given closure [`with_externalities`] grants access to them. The externalities
|
||||
/// are only set for the same thread this function was called from.
|
||||
/// Set the given externalities while executing the given closure. To get access to the
|
||||
/// externalities while executing the given closure [`with_externalities`] grants access to them.
|
||||
/// The externalities are only set for the same thread this function was called from.
|
||||
pub fn set_and_run_with_externalities<F, R>(ext: &mut dyn Externalities, f: F) -> R
|
||||
where
|
||||
F: FnOnce() -> R,
|
||||
|
||||
Reference in New Issue
Block a user