stackabletech / operator-rs

A simple wrapper/framework around kube-rs to make implementing Operators/Controllers easier
Apache License 2.0
122 stars 13 forks source link

Implement Labels::try_from<&BTreeMap<_,_>> #713

Closed NickLarsenNZ closed 9 months ago

NickLarsenNZ commented 9 months ago

I'm trying to convert a &BTreeMap<String,String> into Labels.

https://github.com/stackabletech/hdfs-operator/blob/934beeaa5b5c5e85324ccf93ba4e46cef130c440/rust/operator-binary/src/pod_svc_controller.rs#L57-L67

Code with inferred types:

Showing inferred types

a value of type `stackable_operator::kvp::Labels` cannot be built from an iterator over elements of type `(std::string::String, std::string::String)`
the trait `FromIterator<(std::string::String, std::string::String)>` is not implemented for `stackable_operator::kvp::Labels`
the trait `FromIterator<KeyValuePair<LabelValue>>` is implemented for stackable_operator::kvp::Labels`

I guess we need:

Techassi commented 9 months ago

The linked PR only party fixes this issue. Re-opening.