pub struct TestHeadersClient { /* private fields */ }Available on crate features
test-utils only.Expand description
A test client for fetching headers
Implementations§
Source§impl TestHeadersClient
impl TestHeadersClient
Sourcepub fn request_attempts(&self) -> u64
pub fn request_attempts(&self) -> u64
Return the number of times client was polled
Sourcepub async fn extend(&self, headers: impl IntoIterator<Item = Header>)
pub async fn extend(&self, headers: impl IntoIterator<Item = Header>)
Adds headers to the set.
Sourcepub async fn set_error(&self, err: RequestError)
pub async fn set_error(&self, err: RequestError)
Set response error
Trait Implementations§
Source§impl Clone for TestHeadersClient
impl Clone for TestHeadersClient
Source§impl Debug for TestHeadersClient
impl Debug for TestHeadersClient
Source§impl Default for TestHeadersClient
impl Default for TestHeadersClient
Source§impl DownloadClient for TestHeadersClient
impl DownloadClient for TestHeadersClient
Source§fn report_bad_message(&self, _peer_id: PeerId)
fn report_bad_message(&self, _peer_id: PeerId)
Penalize the peer for responding with a message
that violates validation rules
Source§fn num_connected_peers(&self) -> usize
fn num_connected_peers(&self) -> usize
Returns how many peers the network is currently connected to.
Source§impl HeadersClient for TestHeadersClient
impl HeadersClient for TestHeadersClient
Source§type Output = Pin<Box<dyn Future<Output = Result<WithPeerId<Vec<Header>>, RequestError>> + Sync + Send>>
type Output = Pin<Box<dyn Future<Output = Result<WithPeerId<Vec<Header>>, RequestError>> + Sync + Send>>
The headers future type
Source§fn get_headers_with_priority(
&self,
request: HeadersRequest,
_priority: Priority,
) -> Self::Output
fn get_headers_with_priority( &self, request: HeadersRequest, _priority: Priority, ) -> Self::Output
Sends the header request to the p2p network with priority set and returns the header
response received from a peer.
Source§fn get_headers(&self, request: HeadersRequest) -> Self::Output
fn get_headers(&self, request: HeadersRequest) -> Self::Output
Sends the header request to the p2p network and returns the header response received from a
peer.
Source§fn get_header(
&self,
start: BlockHashOrNumber,
) -> SingleHeaderRequest<Self::Output> ⓘ
fn get_header( &self, start: BlockHashOrNumber, ) -> SingleHeaderRequest<Self::Output> ⓘ
Fetches a single header for the requested number or hash.
Source§fn get_header_with_priority(
&self,
start: BlockHashOrNumber,
priority: Priority,
) -> SingleHeaderRequest<Self::Output> ⓘ
fn get_header_with_priority( &self, start: BlockHashOrNumber, priority: Priority, ) -> SingleHeaderRequest<Self::Output> ⓘ
Fetches a single header for the requested number or hash with priority
Auto Trait Implementations§
impl !RefUnwindSafe for TestHeadersClient
impl !UnwindSafe for TestHeadersClient
impl Freeze for TestHeadersClient
impl Send for TestHeadersClient
impl Sync for TestHeadersClient
impl Unpin for TestHeadersClient
impl UnsafeUnpin for TestHeadersClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeDebug for Twhere
T: Debug,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes