pub trait BTreeMapStrExt {
// Required method
fn insert_str(
&mut self,
key: impl Into<String>,
value: impl Into<String>,
) -> Option<String>;
}Expand description
Substrate extension trait over BTreeMap<String, String> — the ONE
substrate owner of the <map>.insert(<k>.to_string(), <v>.to_string ()) string-string insertion shape every K8s-carrier writer
(ObjectMeta annotations / labels, ConfigMap .data) hand-authored
at the callsite pre-lift.
Peer of crate::json_object::JsonMapStrExt on the same
“insert a string at a string key” write axis, split by receiver
type (JSON-shaped Map<String, Value> vs K8s-canonical
BTreeMap<String, String>). See the module docs for the naming
rationale (why insert_str and not insert) and the callsite
audit.
Required Methods§
Sourcefn insert_str(
&mut self,
key: impl Into<String>,
value: impl Into<String>,
) -> Option<String>
fn insert_str( &mut self, key: impl Into<String>, value: impl Into<String>, ) -> Option<String>
Insert an owned String value at an owned String key into
this K8s-canonical string-string map. Returns Option<String>
matching the underlying BTreeMap::insert semantics — None
for a new key, Some(prev) for an overwrite of an existing
slot.
Both slots accept any impl Into<String> — &str (via
String::from), String (identity), Cow<'_, str>, so a
callsite with a static annotations::POOL (&'static str)
reads insert_str(annotations::POOL, pool_name) with no
.to_string() per-site. Numeric or non-string values still
need an explicit .to_string() at the callsite — same as
pre-lift, so the wrapping shape stays visible in the caller’s
grep footprint.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".