error type implementations

This commit is contained in:
Tadeo hepperle
2024-01-22 18:53:04 +01:00
parent a349daaf45
commit 2c40b14230
32 changed files with 269 additions and 207 deletions
+9 -10
View File
@@ -4,8 +4,7 @@
//! Types representing extrinsics/transactions that have been submitted to a node.
use std::task::Poll;
use crate::prelude::*;
use crate::utils::strip_compact_prefix;
use crate::{
backend::{BlockRef, StreamOfResults, TransactionStatus as BackendTxStatus},
@@ -14,7 +13,7 @@ use crate::{
events::EventsClient,
Config,
};
use crate::prelude::*;
use core::task::Poll;
use derivative::Derivative;
use futures::{Stream, StreamExt};
@@ -25,8 +24,8 @@ pub struct TxProgress<T: Config, C> {
client: C,
}
impl<T: Config, C> std::fmt::Debug for TxProgress<T, C> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl<T: Config, C> fmt::Debug for TxProgress<T, C> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("TxProgress")
.field("sub", &"<subscription>")
.field("ext_hash", &self.ext_hash)
@@ -125,9 +124,9 @@ impl<T: Config, C: Clone> Stream for TxProgress<T, C> {
type Item = Result<TxStatus<T, C>, Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
mut self: core::pin::Pin<&mut Self>,
cx: &mut core::task::Context<'_>,
) -> core::task::Poll<Option<Self::Item>> {
let sub = match self.sub.as_mut() {
Some(sub) => sub,
None => return Poll::Ready(None),
@@ -169,7 +168,7 @@ impl<T: Config, C: Clone> Stream for TxProgress<T, C> {
/// Possible transaction statuses returned from our [`TxProgress::next()`] call.
#[derive(Derivative)]
#[derivative(Debug(bound = "C: std::fmt::Debug"))]
#[derivative(Debug(bound = "C: fmt::Debug"))]
pub enum TxStatus<T: Config, C> {
/// Transaction is part of the future queue.
Validated,
@@ -223,7 +222,7 @@ impl<T: Config, C> TxStatus<T, C> {
/// This struct represents a transaction that has made it into a block.
#[derive(Derivative)]
#[derivative(Debug(bound = "C: std::fmt::Debug"))]
#[derivative(Debug(bound = "C: fmt::Debug"))]
pub struct TxInBlock<T: Config, C> {
block_ref: BlockRef<T::Hash>,
ext_hash: T::Hash,