馃 The Definitive Gemini Protocol Toolkit
gemini gemini-protocol gemtext parser zero-dependency toolkit ast converter html markdown cli networking
at main 34 lines 1.1 kB view raw
1//! This example demonstrates Germ's capabilities for performing a non-blocking 2//! request to a Gemini capsule. 3 4#[tokio::main] 5async fn main() { 6 // Form a valid URL to a Gemini capsule 7 let url = url::Url::parse("gemini://fuwn.me").unwrap(); 8 // Perform a non-blocking request to the Gemini capsule 9 let request = germ::request::request(&url).await; 10 11 match request { 12 // If the request was successful, print a debug view of the response 13 Ok(response) => { 14 // Print the status of the response 15 println!("{:?}", response.status()); 16 17 // Print the meta string of the response 18 // 19 // More detailed meta usage can be found in the `meta` example 20 println!("{}", response.meta()); 21 22 // Print the content of the response, if present 23 println!("{:?}", response.content()); 24 25 // Print the size of the response 26 println!("{:?}", response.size()); 27 28 // Print a debug view of the SSL suite used 29 println!("{:?}", response.suite()); 30 } 31 // If the request was unsuccessful, do nothing 32 Err(_) => {} 33 } 34}