@@ -87,47 +87,6 @@ pub struct JsonRpcError {
8787}
8888
8989/// Unified RPC client for calling host functions
90- ///
91- /// # Example Usage
92- ///
93- /// ```rust
94- /// use blockless_sdk::rpc::RpcClient;
95- /// use serde::{Serialize, Deserialize};
96- ///
97- /// #[derive(Serialize, Deserialize)]
98- /// struct HttpRequest {
99- /// url: String,
100- /// method: String,
101- /// }
102- ///
103- /// #[derive(Serialize, Deserialize)]
104- /// struct HttpResponse {
105- /// status: u16,
106- /// body: String,
107- /// }
108- ///
109- /// // Create client with default 4KB buffer
110- /// let mut client = RpcClient::new();
111- ///
112- /// // Create client with custom buffer size (e.g., 10MB for HTTP responses)
113- /// let mut client = RpcClient::with_buffer_size(10 * 1024 * 1024);
114- ///
115- /// // Type-safe method call
116- /// let request = HttpRequest {
117- /// url: "https://api.example.com".to_string(),
118- /// method: "GET".to_string(),
119- /// };
120- ///
121- /// let response: JsonRpcResponse<HttpResponse> = client.call("http.request", Some(request))?;
122- ///
123- /// // Convenience methods
124- /// let pong = client.ping()?;
125- /// let echo_result = client.echo("Hello World!")?;
126- /// let version = client.version()?;
127- ///
128- /// // Modify buffer size after creation
129- /// client.set_buffer_size(1024 * 1024); // 1MB buffer
130- /// ```
13190pub struct RpcClient {
13291 next_id : u32 ,
13392 buffer_size : usize ,
0 commit comments