mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Introduce WeakBoundedVec, StorageTryAppend, and improve BoundedVec API (#8842)
* fix bounded vec doc and unsafe * fix btree map and set and tests * introduce weak_bounded_vec and StorageTryAppend * fix tests and reorganize tests * improve doc * add doc * Update frame/support/src/storage/weak_bounded_vec.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * fix inner doc Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a183031eef
commit
25625a0f0c
@@ -321,6 +321,7 @@ macro_rules! parameter_types {
|
||||
(IMPL_CONST $name:ident, $type:ty, $value:expr) => {
|
||||
impl $name {
|
||||
/// Returns the value of this parameter type.
|
||||
#[allow(unused)]
|
||||
pub const fn get() -> $type {
|
||||
$value
|
||||
}
|
||||
@@ -335,6 +336,7 @@ macro_rules! parameter_types {
|
||||
(IMPL $name:ident, $type:ty, $value:expr) => {
|
||||
impl $name {
|
||||
/// Returns the value of this parameter type.
|
||||
#[allow(unused)]
|
||||
pub fn get() -> $type {
|
||||
$value
|
||||
}
|
||||
@@ -349,6 +351,7 @@ macro_rules! parameter_types {
|
||||
(IMPL_STORAGE $name:ident, $type:ty, $value:expr) => {
|
||||
impl $name {
|
||||
/// Returns the key for this parameter type.
|
||||
#[allow(unused)]
|
||||
pub fn key() -> [u8; 16] {
|
||||
$crate::sp_io::hashing::twox_128(
|
||||
concat!(":", stringify!($name), ":").as_bytes()
|
||||
@@ -359,6 +362,7 @@ macro_rules! parameter_types {
|
||||
///
|
||||
/// This needs to be executed in an externalities provided
|
||||
/// environment.
|
||||
#[allow(unused)]
|
||||
pub fn set(value: &$type) {
|
||||
$crate::storage::unhashed::put(&Self::key(), value);
|
||||
}
|
||||
@@ -367,6 +371,7 @@ macro_rules! parameter_types {
|
||||
///
|
||||
/// This needs to be executed in an externalities provided
|
||||
/// environment.
|
||||
#[allow(unused)]
|
||||
pub fn get() -> $type {
|
||||
$crate::storage::unhashed::get(&Self::key()).unwrap_or_else(|| $value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user