mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 20:57:59 +00:00
Introduce default-setting prime for collective (#5137)
* Introduce default-setting prime for collective * Docs. * Elections phragmen supports prime * Fix * Membership supports prime * Fix * Update frame/collective/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -91,6 +91,14 @@ impl<T: FullCodec, G: StorageValue<T>> storage::StorageValue<T> for G {
|
||||
unhashed::put(&Self::storage_value_final_key(), &val)
|
||||
}
|
||||
|
||||
fn set(maybe_val: Self::Query) {
|
||||
if let Some(val) = G::from_query_to_optional_value(maybe_val) {
|
||||
unhashed::put(&Self::storage_value_final_key(), &val)
|
||||
} else {
|
||||
unhashed::kill(&Self::storage_value_final_key())
|
||||
}
|
||||
}
|
||||
|
||||
fn kill() {
|
||||
unhashed::kill(&Self::storage_value_final_key())
|
||||
}
|
||||
|
||||
@@ -73,6 +73,10 @@ pub trait StorageValue<T: FullCodec> {
|
||||
/// Store a value under this key into the provided storage instance.
|
||||
fn put<Arg: EncodeLike<T>>(val: Arg);
|
||||
|
||||
/// Store a value under this key into the provided storage instance; this uses the query
|
||||
/// type rather than the underlying value.
|
||||
fn set(val: Self::Query);
|
||||
|
||||
/// Mutate the value
|
||||
fn mutate<R, F: FnOnce(&mut Self::Query) -> R>(f: F) -> R;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user