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