🦠 The Definitive Gemini Protocol Toolkit
gemini gemini-protocol gemtext parser zero-dependency toolkit ast converter html markdown cli networking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

deps(rustc): bump rust toolchain

Fuwn a385a6d2 37546008

+15 -18
+1 -1
rust-toolchain.toml
··· 1 1 [toolchain] 2 - channel = "1.68.2" 2 + channel = "1.79.0"
+4 -15
src/meta.rs
··· 16 16 // Copyright (C) 2022-2022 Fuwn <contact@fuwn.me> 17 17 // SPDX-License-Identifier: GPL-3.0-only 18 18 19 - use std::{borrow::Cow, collections::HashMap}; 19 + use std::{borrow::Cow, collections::HashMap, fmt::Display}; 20 20 21 21 /// Structure-ize a Gemini response's meta section into it's mime type and it's 22 22 /// parameters. ··· 28 28 parameters: HashMap<String, String>, 29 29 } 30 30 31 - impl ToString for Meta { 32 - /// Convert a `Meta` into a `String` 33 - /// 34 - /// # Example 35 - /// ```rust 36 - /// let original_string = "text/gemini; hi=2; hi2=string=2"; 37 - /// 38 - /// assert_eq!( 39 - /// germ::meta::Meta::from_string(original_string).to_string(), 40 - /// original_string 41 - /// ); 42 - /// ``` 43 - fn to_string(&self) -> String { 44 - format!("{}{}", self.mime, { 31 + impl Display for Meta { 32 + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 33 + write!(f, "{}{}", self.mime, { 45 34 let mut parameters = self 46 35 .parameters 47 36 .iter()
+10 -2
src/request/response.rs
··· 16 16 // Copyright (C) 2022-2022 Fuwn <contact@fuwn.me> 17 17 // SPDX-License-Identifier: GPL-3.0-only 18 18 19 - use {crate::request::Status, rustls::SupportedCipherSuite, std::borrow::Cow}; 19 + use { 20 + crate::request::Status, 21 + rustls::SupportedCipherSuite, 22 + std::{borrow::Cow, fmt::Write}, 23 + }; 20 24 21 25 #[derive(Debug, Clone)] 22 26 pub struct Response { ··· 39 43 let mut string_split = string_form.split("\r\n"); 40 44 41 45 header = string_split.next().unwrap_or("").to_string(); 42 - content = Some(string_split.map(|s| format!("{s}\r\n")).collect()); 46 + content = Some(string_split.fold(String::new(), |mut output, s| { 47 + let _ = write!(output, "{s}\r\n"); 48 + 49 + output 50 + })); 43 51 } 44 52 45 53 let header_split = header.split_at(2);