mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
refactor overseer into proc-macro based pattern (#2962)
This commit is contained in:
committed by
GitHub
parent
2510bfc5d7
commit
3c9104daff
@@ -87,13 +87,15 @@ impl Into<sc_network::ObservedRole> for ObservedRole {
|
||||
}
|
||||
}
|
||||
|
||||
/// Implement `TryFrom` for one enum variant into the inner type.
|
||||
/// `$m_ty::$variant(inner) -> Ok(inner)`
|
||||
macro_rules! impl_try_from {
|
||||
($m_ty:ident, $variant:ident, $out:ty) => {
|
||||
impl TryFrom<$m_ty> for $out {
|
||||
type Error = crate::WrongVariant;
|
||||
|
||||
#[allow(unreachable_patterns)] // when there is only one variant
|
||||
fn try_from(x: $m_ty) -> Result<$out, Self::Error> {
|
||||
#[allow(unreachable_patterns)] // when there is only one variant
|
||||
match x {
|
||||
$m_ty::$variant(y) => Ok(y),
|
||||
_ => Err(crate::WrongVariant),
|
||||
|
||||
Reference in New Issue
Block a user