mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-08 12:28:01 +00:00
fa16080a03
* Add ecdsa support to signer * Remove nix. Cleanup. * remove ecdsa example and small tidy * fmt * fix wasm test * feature flag ecdsa/sr25519 support, use global signing context * clippy fix * ensure signers all impl Signer trait in doc test * fix CI * fix digner test * remove dead code warnings when no features enabled * move dead code attr to right place * fix random clippy error that popped up --------- Co-authored-by: Lech Głowiak <lech.glowiak@gmail.com>
42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
// Copyright 2019-2023 Parity Technologies (UK) Ltd.
|
|
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
|
// see LICENSE for license details.
|
|
|
|
#![allow(unused_macros)]
|
|
|
|
/// Use like:
|
|
///
|
|
/// ```rust,ignore
|
|
/// once_static!{
|
|
/// /// Some documentation.
|
|
/// fn foo() -> Vec<u8> {
|
|
/// vec![1,2,3,4]
|
|
/// }
|
|
/// }
|
|
/// ```
|
|
macro_rules! once_static {
|
|
($($(#[$attr:meta])* $vis:vis fn $name:ident() -> $ty:ty { $expr:expr } )+) => {
|
|
$(
|
|
$(#[$attr])*
|
|
$vis fn $name() -> &'static $ty {
|
|
static VAR: std::sync::OnceLock<$ty> = std::sync::OnceLock::new();
|
|
VAR.get_or_init(|| { $expr })
|
|
}
|
|
)+
|
|
};
|
|
}
|
|
|
|
/// Like `once_static!` but clones the item out of static storage. Useful if it
|
|
/// takes a while to create the item but cloning it is fairly cheap.
|
|
macro_rules! once_static_cloned {
|
|
($($(#[$attr:meta])* $vis:vis fn $name:ident() -> $ty:ty { $expr:expr } )+) => {
|
|
$(
|
|
$(#[$attr])*
|
|
$vis fn $name() -> $ty {
|
|
static VAR: std::sync::OnceLock<$ty> = std::sync::OnceLock::new();
|
|
VAR.get_or_init(|| { $expr }).clone()
|
|
}
|
|
)+
|
|
};
|
|
}
|