From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Fri, 5 Mar 2021 17:44:28 +0000 (-0800) Subject: Merge pull request #825 from jkczyz/2021-03-client-visibility X-Git-Tag: v0.0.13~9 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=1efc0c85eb94e6ac8251bcb059432acd32a6a55e;hp=27276695fa74401aa1fda38d3d8390a15ba080d0;p=rust-lightning Merge pull request #825 from jkczyz/2021-03-client-visibility Expose RpcClient and RestClient interfaces as pub --- diff --git a/lightning-block-sync/src/http.rs b/lightning-block-sync/src/http.rs index 0788bc98..a33d919d 100644 --- a/lightning-block-sync/src/http.rs +++ b/lightning-block-sync/src/http.rs @@ -399,10 +399,10 @@ enum HttpMessageLength { } /// An HTTP response body in binary format. -pub(crate) struct BinaryResponse(pub(crate) Vec); +pub struct BinaryResponse(pub Vec); /// An HTTP response body in JSON format. -pub(crate) struct JsonResponse(pub(crate) serde_json::Value); +pub struct JsonResponse(pub serde_json::Value); /// Interprets bytes from an HTTP response body as binary data. impl TryFrom> for BinaryResponse { diff --git a/lightning-block-sync/src/rest.rs b/lightning-block-sync/src/rest.rs index 3c2e76e2..3aff104d 100644 --- a/lightning-block-sync/src/rest.rs +++ b/lightning-block-sync/src/rest.rs @@ -24,7 +24,7 @@ impl RestClient { } /// Requests a resource encoded in `F` format and interpreted as type `T`. - async fn request_resource(&mut self, resource_path: &str) -> std::io::Result + pub async fn request_resource(&mut self, resource_path: &str) -> std::io::Result where F: TryFrom, Error = std::io::Error> + TryInto { let host = format!("{}:{}", self.endpoint.host(), self.endpoint.port()); let uri = format!("{}/{}", self.endpoint.path().trim_end_matches("/"), resource_path); diff --git a/lightning-block-sync/src/rpc.rs b/lightning-block-sync/src/rpc.rs index 34cbd2e0..d59401e0 100644 --- a/lightning-block-sync/src/rpc.rs +++ b/lightning-block-sync/src/rpc.rs @@ -34,7 +34,7 @@ impl RpcClient { } /// Calls a method with the response encoded in JSON format and interpreted as type `T`. - async fn call_method(&mut self, method: &str, params: &[serde_json::Value]) -> std::io::Result + pub async fn call_method(&mut self, method: &str, params: &[serde_json::Value]) -> std::io::Result where JsonResponse: TryFrom, Error = std::io::Error> + TryInto { let host = format!("{}:{}", self.endpoint.host(), self.endpoint.port()); let uri = self.endpoint.path();