MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / to_commented_toml

Method to_commented_toml

certbot/cli/src/main.rs:100–119  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

98
99impl Config {
100 fn to_commented_toml(&self) -> Result<String> {
101 let mut doc = to_document(self)?;
102
103 for (i, (mut key, _value)) in doc.iter_mut().enumerate() {
104 let decor = key.leaf_decor_mut();
105 let docstring = Self::FIELD_DOCS[i];
106
107 let mut comment = String::new();
108 for line in docstring.lines() {
109 let line = if line.is_empty() {
110 String::from("#\n")
111 } else {
112 format!("# {line}\n")
113 };
114 comment.push_str(&line);
115 }
116 decor.set_prefix(comment);
117 }
118 Ok(doc.to_string())
119 }
120}
121
122fn load_config(config: &PathBuf) -> Result<CertBotConfig> {

Callers 1

mainFunction · 0.80

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected