### Rust Quick Start: Making an HTTP GET Request Source: https://github.com/zen-rs/zenwave/blob/main/README.md Demonstrates a basic asynchronous HTTP GET request using the `zenwave` crate. It fetches data from a URL and prints the response body as text. Requires the `async-std` runtime. ```rust use zenwave::{get, ResponseExt}; #[async_std::main] async fn main() -> zenwave::Result<()> { let response = get("https://httpbin.org/get").await?; let text = response.into_string().await?; println!("{text}"); Ok(()) } ``` -------------------------------- ### Rust Bash: Android NDK and Build Setup for Zenwave Source: https://github.com/zen-rs/zenwave/blob/main/README.md Provides an example of setting the `ANDROID_NDK` environment variable and then building a Rust project for Android using `cargo build` with the appropriate target triple. This is necessary for cross-compiling Zenwave applications for Android. ```bash # Set environment and build export ANDROID_NDK=$HOME/Library/Android/sdk/ndk/29.0.14206865 cargo build --target aarch64-linux-android ``` -------------------------------- ### Install Build Essentials on Ubuntu/Debian Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Installs the `build-essential` package on Ubuntu/Debian systems, which provides essential tools like `make` required for compilation and troubleshooting build issues. ```bash # Ubuntu/Debian sudo apt install build-essential ``` -------------------------------- ### Install and Use cargo-ndk Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Installs the `cargo-ndk` utility, a tool that simplifies the Android NDK setup for Rust projects. It provides commands to automatically configure the NDK environment and build projects for specified Android targets. ```bash cargo install cargo-ndk cargo ndk -t aarch64-linux-android build --release ``` -------------------------------- ### Install Xcode Command Line Tools on macOS Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Installs the Xcode Command Line Tools on macOS, which include essential build utilities such as `make`, often required for compilation and resolving build-related errors. ```bash # macOS (comes with Xcode Command Line Tools) xcode-select --install ``` -------------------------------- ### Manage Cookies with Zenwave Client Source: https://context7.com/zen-rs/zenwave/llms.txt This example demonstrates how to enable automatic cookie handling using the Zenwave client. It includes an in-memory cookie jar for all platforms and shows how to use persistent cookie storage on native platforms for saving cookies to disk. The code covers setting cookies via a POST request and automatically including them in subsequent GET requests. ```rust use zenwave::{client, Client}; #[async_std::main] async fn main() -> zenwave::Result<()> { // In-memory cookie jar (works on all platforms) let mut client = client() .enable_cookie(); // Login request sets session cookie let response = client .post("https://example.com/login")? .form_body(&[("username", "user"), ("password", "pass")])?; .await?; println!("Login status: {}", response.status()); // Subsequent requests automatically include cookies let response = client .get("https://example.com/profile")?; .await?; println!("Profile access: {}", response.status()); // For native platforms, use persistent cookie storage #[cfg(not(target_arch = "wasm32"))] { let mut persistent_client = zenwave::client() .enable_persistent_cookie(); // Saves to disk let response = persistent_client .get("https://example.com/api/data")?; .await?; println!("Persistent cookies enabled"); } Ok(()) } ``` -------------------------------- ### Simple GET Request with JSON Deserialization in Rust Source: https://context7.com/zen-rs/zenwave/llms.txt Fetches data from a specified API endpoint using a simple GET request and deserializes the JSON response into a Rust struct. This example uses the `zenwave` crate and `serde` for JSON handling. It requires the `async-std` runtime. ```rust use zenwave::{get, ResponseExt}; use serde::Deserialize; #[derive(Debug, Deserialize)] struct Todo { #[serde(rename = "userId")] user_id: u32, id: u32, title: String, completed: bool, } #[async_std::main] async fn main() -> zenwave::Result<()> { let response = get("https://jsonplaceholder.typicode.com/todos/1").await?; let todo: Todo = response.into_json().await?; println!("Todo #{}: {}", todo.id, todo.title); println!("Completed: {}", todo.completed); Ok(()) } ``` -------------------------------- ### Rust: Composing Zenwave Middleware for HTTP Requests Source: https://github.com/zen-rs/zenwave/blob/main/README.md Illustrates how to chain multiple middleware functions onto a `zenwave` client builder to customize request behavior. This example adds timeout, retry, redirect following, caching, cookie management, bearer token authentication, and OAuth2 client credentials flow. ```rust use std::time::Duration; use zenwave::{client, OAuth2ClientCredentials}; let client = client() .timeout(Duration::from_secs(30)) // Per-request timeout .retry(3) // Retry transport errors (not HTTP errors) .follow_redirect() // Follow up to 10 redirects .enable_cache() // RFC-compliant HTTP caching .enable_cookie() // In-memory cookie jar .bearer_auth("token") // Authorization header .with(OAuth2ClientCredentials::new( // Auto-refresh OAuth2 tokens "https://auth.example.com/token", "client-id", "client-secret", )); ``` -------------------------------- ### Configure Proxies for HTTP and SOCKS in Rust Source: https://context7.com/zen-rs/zenwave/llms.txt This example shows how to configure HTTP and SOCKS proxies for the Zenwave client. Proxies can be loaded from environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) or configured manually using the Proxy builder. This functionality is available on native platforms. The client is initialized with proxy settings before making requests. ```rust use zenwave::{client_with_proxy, Proxy, Client}; #[async_std::main] async fn main() -> zenwave::Result<()> { // Load proxy settings from environment variables // HTTP_PROXY, HTTPS_PROXY, NO_PROXY let client = client_with_proxy(Proxy::from_env()); // Or configure manually let proxy = Proxy::builder() .http("http://proxy.example.com:8080") .https("http://proxy.example.com:8080") .no_proxy("localhost,*.internal.com,127.0.0.1") .build(); let mut client = client_with_proxy(proxy); let response = client .get("https://api.example.com/data")? .await?; println!("Status: {}", response.status()); Ok(()) } ``` -------------------------------- ### Set Android NDK Environment Variable Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Sets the ANDROID_NDK environment variable to point to the installed Android NDK directory. Examples are provided for macOS, Linux with Android Studio, and standalone NDK installations. ```bash # Example paths export ANDROID_NDK=$HOME/Library/Android/sdk/ndk/29.0.14206865 # macOS with Android Studio export ANDROID_NDK=$HOME/Android/Sdk/ndk/29.0.14206865 # Linux with Android Studio export ANDROID_NDK=/opt/android-ndk-r27c # Standalone NDK ``` -------------------------------- ### Build Reusable HTTP Client with Middleware in Rust Source: https://context7.com/zen-rs/zenwave/llms.txt Constructs a reusable HTTP client with a composed middleware stack including timeout, retries, redirects, cookies, and bearer authentication. It demonstrates making a POST request with a JSON body. This example requires `zenwave` and `serde`. ```rust use std::time::Duration; use zenwave::{client, Client}; use serde::{Serialize, Deserialize}; #[derive(Serialize)] struct CreatePost<'a> { title: &'a str, body: &'a str, user_id: u32, } #[derive(Debug, Deserialize)] struct Post { id: u32, title: String, body: String, user_id: u32, } #[async_std::main] async fn main() -> zenwave::Result<()> { // Compose middleware stack let mut client = client() .timeout(Duration::from_secs(30)) .retry(3) .follow_redirect() .enable_cache() .enable_cookie() .bearer_auth("your-api-token"); // Make POST request with JSON body let post = CreatePost { title: "Zenwave Tutorial", body: "Building cross-platform HTTP clients", user_id: 1, }; let response: Post = client .post("https://jsonplaceholder.typicode.com/posts")? .header("Content-Type", "application/json")? .json_body(&post)? .json() .await?; println!("Created post with ID: {}", response.id); Ok(()) } ``` -------------------------------- ### Install CMake on macOS and Linux Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Installs CMake, a build system generator required by the aws-lc-rs dependency, on macOS using Homebrew and on Debian/Ubuntu-based Linux distributions using apt. ```bash # macOS brew install cmake ``` ```bash # Ubuntu/Debian sudo apt install cmake ``` -------------------------------- ### OAuth2 Client Credentials Flow with Zenwave in Rust Source: https://context7.com/zen-rs/zenwave/llms.txt Implements the OAuth2 client credentials grant flow for automatically acquiring and refreshing access tokens. This example configures an `OAuth2ClientCredentials` middleware and demonstrates making authenticated requests. It requires `zenwave` and `serde`. ```rust use zenwave::{client, Client, OAuth2ClientCredentials}; use serde::Deserialize; #[derive(Debug, Deserialize)] struct ApiResponse { data: Vec, } #[async_std::main] async fn main() -> zenwave::Result<()> { // Configure OAuth2 middleware with client credentials let oauth2 = OAuth2ClientCredentials::new( "https://auth.example.com/oauth/token", "your-client-id", "your-client-secret" ) .with_scope("api:read api:write") .with_audience("https://api.example.com"); // Tokens are automatically fetched and refreshed let mut client = client() .with(oauth2) .enable_cache(); // First request acquires token let response: ApiResponse = client .get("https://api.example.com/data")? .json() .await?; println!("Received {} items", response.data.len()); // Subsequent requests reuse cached token let response: ApiResponse = client .get("https://api.example.com/more-data")? .json() .await?; println!("Received {} more items", response.data.len()); Ok(()) } ``` -------------------------------- ### Add Android Rust Targets Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Installs the necessary Rust targets for Android cross-compilation, including ARM64, ARM32, and x86_64 architectures. ```bash rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android ``` -------------------------------- ### Split WebSocket Channels for Concurrency in Rust Source: https://context7.com/zen-rs/zenwave/llms.txt This example illustrates how to split a WebSocket connection into separate sender and receiver channels, enabling concurrent operations. It uses `async_std::task` to spawn a task for receiving messages while the main task handles sending. This is useful for managing real-time communication efficiently. ```rust use zenwave::websocket::{self, WebSocketMessage}; use async_std::task; #[async_std::main] async fn main() -> zenwave::Result<()> { let socket = websocket::connect("wss://ws.example.com/chat").await?; let (sender, receiver) = socket.split(); // Spawn task for receiving messages let receive_handle = task::spawn(async move { while let Ok(Some(message)) = receiver.recv().await { if let WebSocketMessage::Text(text) = message { println!("Received: {}", text); } } }); // Send messages from main task for i in 1..=5 { sender.send_text(format!("Message {}", i)).await?; task::sleep(std::time::Duration::from_secs(1)).await; } sender.close().await?; receive_handle.await; Ok(()) } ``` -------------------------------- ### Rust Cargo.toml: Zenwave Dependency Installation Source: https://github.com/zen-rs/zenwave/blob/main/README.md Specifies the `zenwave` crate as a dependency in a Rust project's `Cargo.toml` file. This is the standard way to add the crate and its default features to your project. ```toml [dependencies] zenwave = "0.2" ``` -------------------------------- ### Building HTTP Requests with ZenWave Client Source: https://github.com/zen-rs/zenwave/blob/main/README.md Demonstrates how to construct different types of HTTP requests using the ZenWave client. It covers sending JSON, form data, and raw bytes as request bodies, along with setting custom headers and authentication tokens. ```rust use zenwave::client; let client = client(); // JSON request/response let response: MyResponse = client .post("https://api.example.com/data")? // Specify the URL and HTTP method .header("X-Request-ID", "abc123")? // Add a custom header .bearer_auth("token")? // Set Bearer token for authentication .json_body(&MyRequest { field: "value" })? // Set the request body as JSON .json() .await?; // Send the request and expect a JSON response // Form data let response = client .post("https://example.com/form")? // Specify the URL and HTTP method .form_body(&[("key", "value")])? // Set the request body as form data .await?; // Send the request and await the response // Raw bytes let response = client .post("https://example.com/upload")? // Specify the URL and HTTP method .bytes_body(vec![1, 2, 3]) // Set the request body as raw bytes .await?; // Send the request and await the response ``` -------------------------------- ### Proxy Support Configuration (Rust) Source: https://github.com/zen-rs/zenwave/blob/main/README.md Shows how to configure proxy settings for the ZenWave client. It covers setting proxies from environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) and manual configuration using a builder pattern. ```rust use zenwave::{client_with_proxy, Proxy}; // From environment (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) let client = client_with_proxy(Proxy::from_env()); // Manual configuration let proxy = Proxy::builder() .http("http://proxy:8080") // Set HTTP proxy .https("http://proxy:8080") // Set HTTPS proxy .no_proxy("localhost,*.internal.com") // Specify hosts that should not use the proxy .build(); let client = client_with_proxy(proxy); // Create client with manual proxy configuration ``` -------------------------------- ### Download Files with Resume Support in Rust Source: https://context7.com/zen-rs/zenwave/llms.txt This snippet demonstrates how to download files using the Zenwave client, with automatic support for resuming partial downloads. It relies on the 'zenwave' crate and the 'async-std' runtime. The function takes a URL and a file path as input and returns download progress information, including bytes written, total size, and whether the download was resumed. ```rust use zenwave::{client, Client}; #[async_std::main] async fn main() -> zenwave::Result<()> { let mut client = client(); // Automatically resumes partial downloads using Range requests let report = client .get("https://example.com/large-file.iso")? .download_to_path("large-file.iso") .await?; println!("Downloaded {} bytes", report.bytes_written); println!("Total file size: {} bytes", report.total_size); println!("Was resumed: {}", report.resumed); Ok(()) } ``` -------------------------------- ### WebSocket Client Basic Usage (Rust) Source: https://github.com/zen-rs/zenwave/blob/main/README.md Demonstrates the basic usage of the ZenWave WebSocket client. It shows how to connect to a WebSocket server, send text messages, receive messages, and close the connection. ```rust use zenwave::websocket::{self, WebSocketMessage}; let socket = websocket::connect("wss://echo.websocket.events").await?; // Connect to the WebSocket server socket.send_text("hello").await?; // Send a text message // Receive a message and check if it's text if let Some(WebSocketMessage::Text(text)) = socket.recv().await? { println!("Received: {text}"); } socket.close().await?; // Close the WebSocket connection ``` -------------------------------- ### File Operations with ZenWave Client (Rust) Source: https://github.com/zen-rs/zenwave/blob/main/README.md Illustrates how to perform file uploads and downloads using the ZenWave client. It shows streaming file uploads without buffering and downloading files with automatic resume capabilities. ```rust // Stream file upload without buffering client .post("https://example.com/upload")? // Specify the URL and HTTP method .file_body("large-file.zip") // Upload a file from the specified path .await? .await?; // Await the response after uploading // Download with automatic resume let report = client .get("https://example.com/large-file.iso")? // Specify the URL and HTTP method .download_to_path("large-file.iso") // Download the file to the specified path .await?; // Await the download and get a report println!("Downloaded {} bytes", report.bytes_written); ``` -------------------------------- ### Rust Cargo.toml: Selecting Zenwave Backends and Features Source: https://github.com/zen-rs/zenwave/blob/main/README.md Shows how to configure `zenwave` dependencies in `Cargo.toml` to select specific backends (like `hyper-native-tls`, `curl-backend`, `apple-backend`) or features (like WebSocket support `ws`). Disabling default features (`default-features = false`) is necessary when specifying custom features. ```toml # Hyper with platform-native TLS (OpenSSL/Security.framework/SChannel) zenwave = { version = "0.2", default-features = false, features = ["hyper-native-tls", "ws"] } # libcurl backend zenwave = { version = "0.2", default-features = false, features = ["curl-backend"] } # Apple URLSession (macOS/iOS only, experimental) zenwave = { version = "0.2", default-features = false, features = ["apple-backend"] } ``` -------------------------------- ### Build HTTP Requests with Custom Headers in Rust Source: https://context7.com/zen-rs/zenwave/llms.txt This snippet demonstrates building complex HTTP requests using the Zenwave client's request builder. It shows how to add custom headers, authentication tokens (Bearer and Basic), and various body types including JSON, form-encoded data, and raw bytes. This allows for flexible and detailed interaction with APIs. ```rust use zenwave::{client, Client}; use serde::Serialize; #[derive(Serialize)] struct Metrics { cpu_usage: f64, memory_mb: u64, timestamp: u64, } #[async_std::main] async fn main() -> zenwave::Result<()> { let mut client = client(); // JSON request let metrics = Metrics { cpu_usage: 45.2, memory_mb: 2048, timestamp: 1609459200, }; let response = client .post("https://api.example.com/metrics")? .header("X-Request-ID", "abc-123")? .header("X-API-Version", "v2")? .bearer_auth("token")? .json_body(&metrics)? .await?; println!("Metrics submitted: {}", response.status()); // Form-encoded request let response = client .post("https://api.example.com/login")? .header("User-Agent", "Zenwave Client/1.0")? .basic_auth("username", Some("password"))? .form_body(&[("grant_type", "password")])? .await?; println!("Login status: {}", response.status()); // Raw bytes request let data = vec![0x00, 0x01, 0x02, 0x03]; let response = client .put("https://api.example.com/binary")? .header("Content-Type", "application/octet-stream")? .bytes_body(data) .await?; println!("Binary upload: {}", response.status()); Ok(()) } ``` -------------------------------- ### Add NDK Toolchain Bin to PATH Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Appends the NDK toolchain's bin directory to the system's PATH environment variable. This allows the system to find NDK compilers and tools without needing to specify their full paths, often resolving 'failed to find tool' errors. ```bash export PATH="$NDK_PATH/toolchains/llvm/prebuilt/$HOST_TAG/bin:$PATH" ``` -------------------------------- ### File Upload with Streaming in Rust (Native Only) Source: https://context7.com/zen-rs/zenwave/llms.txt Demonstrates streaming large files directly from disk for upload without loading the entire file into memory. This feature is limited to native platforms. It requires the `zenwave` crate and utilizes `async-std`. ```rust use zenwave::{client, Client}; #[async_std::main] async fn main() -> zenwave::Result<()> { let mut client = client() .timeout(std::time::Duration::from_secs(300)); // Stream file directly from disk let response = client .post("https://upload.example.com/files")? .header("Content-Type", "application/octet-stream")? .file_body("large-video.mp4") .await? .await?; if response.status().is_success() { println!("Upload completed successfully"); } else { eprintln!("Upload failed with status: {}", response.status()); } Ok(()) } ``` -------------------------------- ### Enable HTTP Caching with Zenwave Client Source: https://context7.com/zen-rs/zenwave/llms.txt This snippet shows how to enable in-memory HTTP caching for the Zenwave client. It demonstrates making two requests to the same URL, where the second request is served from the cache if it's still fresh, respecting standard caching headers like Cache-Control, Expires, ETag, and Last-Modified. Dependencies include `zenwave` and `serde_json`. ```rust use zenwave::{client, Client}; #[async_std::main] async fn main() -> zenwave::Result<()> { // Enable in-memory HTTP cache let mut client = client() .enable_cache(); // First request hits the network let response = client .get("https://api.example.com/static/config.json")? .await?; println!("First request status: {}", response.status()); let config: serde_json::Value = response.into_json().await?; // Second request served from cache if fresh // Honors Cache-Control, Expires, ETag, Last-Modified headers let response = client .get("https://api.example.com/static/config.json")? .await?; // Check Age header to see cache hit if let Some(age) = response.headers().get("age") { println!("Served from cache (age: {} seconds)", age.to_str().unwrap()); } let config: serde_json::Value = response.into_json().await?; println!("Config loaded: {}", config); Ok(()) } ``` -------------------------------- ### Build Zenwave for Android using Cargo Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Builds the Zenwave project for the specified Android target using Cargo. Includes commands for checking compilation and building in release mode for the aarch64-linux-android target. ```bash # Check compilation cargo check --target aarch64-linux-android # Build release cargo build --target aarch64-linux-android --release ``` -------------------------------- ### WebSocket Client Split for Concurrency (Rust) Source: https://github.com/zen-rs/zenwave/blob/main/README.md Explains how to split the ZenWave WebSocket client into sender and receiver halves for concurrent send and receive operations. This is useful for managing communication in separate tasks. ```rust let (sender, receiver) = socket.split(); // Split the WebSocket connection // Send from one task sender.send_text("message").await?; // Send a message using the sender half // Receive from another while let Some(msg) = receiver.recv().await? { println!("{:?}", msg); // Process received messages using the receiver half } ``` -------------------------------- ### Cargo Configuration for Android Targets Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Configures the Cargo build system via `.cargo/config.toml` to use the NDK's clang compilers as linkers for specific Android targets (aarch64, armv7, x86_64). This simplifies the build process by embedding linker paths directly into the Cargo configuration. ```toml [target.aarch64-linux-android] linker = "/path/to/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang" [target.armv7-linux-androideabi] linker = "/path/to/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi24-clang" [target.x86_64-linux-android] linker = "/path/to/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android24-clang" ``` -------------------------------- ### Full Android NDK Environment Configuration for Cross-Compilation Source: https://github.com/zen-rs/zenwave/blob/main/docs/android.md Configures essential environment variables for cross-compiling Rust code for Android targets (aarch64, armv7, x86_64). It sets the NDK path, identifies the host platform's toolchain, and defines the C/C++ compilers and archivers for each target. ```bash # Set NDK path NDK_PATH=$HOME/Library/Android/sdk/ndk/29.0.14206865 # Detect host platform case "$(uname -s)" in Darwin) HOST_TAG="darwin-x86_64" ;; Linux) HOST_TAG="linux-x86_64" ;; esac TOOLCHAIN=$NDK_PATH/toolchains/llvm/prebuilt/$HOST_TAG/bin # Set environment variables for aarch64 export ANDROID_NDK_HOME="$NDK_PATH" export CC_aarch64_linux_android="$TOOLCHAIN/aarch64-linux-android24-clang" export CXX_aarch64_linux_android="$TOOLCHAIN/aarch64-linux-android24-clang++" export AR_aarch64_linux_android="$TOOLCHAIN/llvm-ar" # For armv7 export CC_armv7_linux_androideabi="$TOOLCHAIN/armv7a-linux-androideabi24-clang" export CXX_armv7_linux_androideabi="$TOOLCHAIN/armv7a-linux-androideabi24-clang++" export AR_armv7_linux_androideabi="$TOOLCHAIN/llvm-ar" # For x86_64 export CC_x86_64_linux_android="$TOOLCHAIN/x86_64-linux-android24-clang" export CXX_x86_64_linux_android="$TOOLCHAIN/x86_64-linux-android24-clang++" export AR_x86_64_linux_android="$TOOLCHAIN/llvm-ar" ``` -------------------------------- ### Handle Errors and Process Responses with Zenwave Client Source: https://context7.com/zen-rs/zenwave/llms.txt This Rust code illustrates robust error handling and response processing with the Zenwave client. It shows how to manage different HTTP status codes, parse JSON responses, read error messages from client errors, and retrieve raw bytes or strings from the response body. It also includes specific error handling for timeouts and transport errors, with dependencies on `zenwave` and standard Rust error types. ```rust use zenwave::{client, Client, Error}; #[async_std::main] async fn main() -> Result<(), Box> { let mut client = client(); // Handle different response types match client.get("https://httpbin.org/json")?.await { Ok(response) => { let status = response.status(); println!("Status: {}", status); if status.is_success() { // Parse as JSON let json: serde_json::Value = response.into_json().await?; println!("JSON response: {}", json); } else if status.is_client_error() { // Read error message let text = response.into_body().into_string().await?; eprintln!("Client error: {}", text); } else if status.is_server_error() { eprintln!("Server error: {}", status); } } Err(Error::Timeout) => { eprintln!("Request timed out"); } Err(Error::Transport(msg)) => { eprintln!("Network error: {}", msg); } Err(e) => { eprintln!("Request failed: {}", e); } } // Get raw bytes let response = client.get("https://httpbin.org/image/png")?.await?; let bytes = response.into_body().into_bytes().await?; println!("Downloaded {} bytes", bytes.len()); // Get string let response = client.get("https://httpbin.org/html")?.await?; let html = response.into_body().into_string().await?; println!("HTML length: {}", html.len()); Ok(()) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.