MCPcopy Create free account
hub / github.com/chatmail/core / set_optional

Method set_optional

src/param.rs:367–373  ·  view source on GitHub ↗

Sets the given key from an optional value. Removes the key if the value is `None`.

(&mut self, key: Param, value: Option<impl ToString>)

Source from the content-addressed store, hash-verified

365 /// Sets the given key from an optional value.
366 /// Removes the key if the value is `None`.
367 pub fn set_optional(&mut self, key: Param, value: Option<impl ToString>) -> &mut Self {
368 if let Some(value) = value {
369 self.set(key, value)
370 } else {
371 self.remove(key)
372 }
373 }
374
375 /// Check if there are any values in this.
376 pub fn is_empty(&self) -> bool {

Callers 7

prepare_msg_rawMethod · 0.80
add_contact_to_chat_exFunction · 0.80
send_member_removal_msgFunction · 0.80
set_file_from_bytesMethod · 0.80
set_quote_textMethod · 0.80

Calls 2

setMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected