Struct lightning_block_sync::rest::RestClient
source · [−]pub struct RestClient { /* private fields */ }
Available on crate feature
rest-client
only.Expand description
A simple REST client for requesting resources using HTTP GET
.
Implementations
sourceimpl RestClient
impl RestClient
sourcepub fn new(endpoint: HttpEndpoint) -> Result<Self>
pub fn new(endpoint: HttpEndpoint) -> Result<Self>
Creates a new REST client connected to the given endpoint.
The endpoint should contain the REST path component (e.g., http://127.0.0.1:8332/rest).
Trait Implementations
sourceimpl BlockSource for RestClient
impl BlockSource for RestClient
sourcefn get_header<'a>(
&'a self,
header_hash: &'a BlockHash,
_height: Option<u32>
) -> AsyncBlockSourceResult<'a, BlockHeaderData>
fn get_header<'a>(
&'a self,
header_hash: &'a BlockHash,
_height: Option<u32>
) -> AsyncBlockSourceResult<'a, BlockHeaderData>
Returns the header for a given hash. A height hint may be provided in case a block source cannot easily find headers based on a hash. This is merely a hint and thus the returned header must have the same hash as was requested. Otherwise, an error must be returned. Read more
sourcefn get_block<'a>(
&'a self,
header_hash: &'a BlockHash
) -> AsyncBlockSourceResult<'a, Block>
fn get_block<'a>(
&'a self,
header_hash: &'a BlockHash
) -> AsyncBlockSourceResult<'a, Block>
Returns the block for a given hash. A headers-only block source should return a Transient
error. Read more
sourcefn get_best_block<'a>(
&'a self
) -> AsyncBlockSourceResult<'a, (BlockHash, Option<u32>)>
fn get_best_block<'a>(
&'a self
) -> AsyncBlockSourceResult<'a, (BlockHash, Option<u32>)>
Returns the hash of the best block and, optionally, its height. Read more
Auto Trait Implementations
impl !RefUnwindSafe for RestClient
impl Send for RestClient
impl Sync for RestClient
impl Unpin for RestClient
impl !UnwindSafe for RestClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more