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

refactor: optimise more arguments

fuwn.net 3dbae42a ce929f2d

verified
+7 -3
+5 -2
crates/germ/src/convert.rs
··· 68 68 /// ); 69 69 /// ``` 70 70 #[must_use] 71 - pub fn from_string(source: &str, target: &Target) -> String { 72 - from_ast(&Ast::from_owned(&source), target) 71 + pub fn from_string( 72 + source: &(impl ToString + ?Sized), 73 + target: &Target, 74 + ) -> String { 75 + from_ast(&Ast::from_owned(&source.to_string()), target) 73 76 }
+2 -1
crates/germ/src/meta.rs
··· 82 82 /// ); 83 83 /// ``` 84 84 #[must_use] 85 - pub fn from_string(meta: &str) -> Self { 85 + pub fn from_string(meta: impl Into<std::borrow::Cow<'static, str>>) -> Self { 86 + let meta = meta.into().to_string(); 86 87 let mut metas = meta.split(';'); 87 88 let mime = metas.next().unwrap_or("").to_string(); 88 89 let mut parameters = HashMap::new();