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

refactor: optimise return types

fuwn.net b0950591 3dbae42a

verified
+5 -3
+2 -2
crates/germ/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::collections::HashMap; 19 + use std::{borrow::Cow, collections::HashMap}; 20 20 21 21 /// Structure-ize a Gemini response's meta section into it's mime type and it's 22 22 /// parameters. ··· 116 116 /// ); 117 117 /// ``` 118 118 #[must_use] 119 - pub fn mime(&self) -> &str { &self.mime } 119 + pub fn mime(&self) -> Cow<'_, str> { Cow::Borrowed(&self.mime) } 120 120 121 121 /// Obtain mutable access to the mime of the `Meta` 122 122 ///
+3 -1
crates/germ/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 std::borrow::Cow; 20 + 19 21 use rustls::SupportedCipherSuite; 20 22 21 23 use crate::request::Status; ··· 59 61 pub const fn status(&self) -> &Status { &self.status } 60 62 61 63 #[must_use] 62 - pub fn meta(&self) -> &str { &self.meta } 64 + pub fn meta(&self) -> Cow<'_, str> { Cow::Borrowed(&self.meta) } 63 65 64 66 #[must_use] 65 67 pub const fn content(&self) -> &Option<String> { &self.content }