tangled
alpha
login
or
join now
fuwn.net
/
germ
0
fork
atom
🦠 The Definitive Gemini Protocol Toolkit
gemini
gemini-protocol
gemtext
parser
zero-dependency
toolkit
ast
converter
html
markdown
cli
networking
0
fork
atom
overview
issues
pulls
pipelines
refactor: optimise return types
fuwn.net
2 years ago
b0950591
3dbae42a
verified
This commit was signed with the committer's
known signature
.
fuwn.net
SSH Key Fingerprint:
SHA256:VPdFPyPbd6JkoMyWUdZ/kkTcIAt3sxjXD2XSAZ7FYC4=
+5
-3
2 changed files
expand all
collapse all
unified
split
crates
germ
src
meta.rs
request
response.rs
+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
19
-
use std::collections::HashMap;
19
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
119
-
pub fn mime(&self) -> &str { &self.mime }
119
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
19
+
use std::borrow::Cow;
20
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
62
-
pub fn meta(&self) -> &str { &self.meta }
64
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 }