mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +00:00
generate docs for feature gated items (#1332)
* generate docs for feature-gated items on crates.io * add newline in Cargo.toml * unify newlines * fix clippy * introduce macros for features * commit missing file * Update subxt/src/lib.rs * make it compile
This commit is contained in:
+19
-17
@@ -15,6 +15,7 @@ pub mod polkadot;
|
||||
pub mod signed_extensions;
|
||||
pub mod substrate;
|
||||
|
||||
use crate::macros::cfg_substrate_compat;
|
||||
use codec::{Decode, Encode};
|
||||
use core::fmt::Debug;
|
||||
use scale_decode::DecodeAsType;
|
||||
@@ -125,28 +126,29 @@ pub trait Header: Sized + Encode + Decode {
|
||||
}
|
||||
}
|
||||
|
||||
/// implement subxt's Hasher and Header traits for some substrate structs
|
||||
#[cfg(feature = "substrate-compat")]
|
||||
mod substrate_impls {
|
||||
use super::*;
|
||||
cfg_substrate_compat! {
|
||||
/// implement subxt's Hasher and Header traits for some substrate structs
|
||||
mod substrate_impls {
|
||||
use super::*;
|
||||
|
||||
impl<T: sp_runtime::traits::Header> Header for T
|
||||
where
|
||||
<T as sp_runtime::traits::Header>::Number: Into<u64>,
|
||||
{
|
||||
type Number = T::Number;
|
||||
type Hasher = T::Hashing;
|
||||
impl<T: sp_runtime::traits::Header> Header for T
|
||||
where
|
||||
<T as sp_runtime::traits::Header>::Number: Into<u64>,
|
||||
{
|
||||
type Number = T::Number;
|
||||
type Hasher = T::Hashing;
|
||||
|
||||
fn number(&self) -> Self::Number {
|
||||
*self.number()
|
||||
fn number(&self) -> Self::Number {
|
||||
*self.number()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: sp_runtime::traits::Hash> Hasher for T {
|
||||
type Output = T::Output;
|
||||
impl<T: sp_runtime::traits::Hash> Hasher for T {
|
||||
type Output = T::Output;
|
||||
|
||||
fn hash(s: &[u8]) -> Self::Output {
|
||||
<T as sp_runtime::traits::Hash>::hash(s)
|
||||
fn hash(s: &[u8]) -> Self::Output {
|
||||
<T as sp_runtime::traits::Hash>::hash(s)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user