set_stringset_expand_string and set_multi_string only accept one generic type. This can make them hard to use, as it means the name and value need to use the same string type. Can it be changed so that they have two generic types, one for name and another for value?
[!Note]
set_multi_string does not accept an empty array easily with this signature.
I came across a problem with code like this.
let order_key = windows_registry::LOCAL_MACHINE.create(r"SYSTEM\CurrentControlSet\Control\NetworkProvider\Order").unwrap();
let mut providers = order_key.get_multi_string("ProviderOrder").unwrap();
providers.push("TestThing".into());
order_key.set_multi_string("ProviderOrder", &providers).unwrap();
It was causing an error (E0308), because providers was a Vec<String> and the generic type T was &str.
I fixed by adding .to_string() after "ProviderOrder". I feel like that is bad rust code, but it was the easiest way to fix it.
Suggestion
set_string
set_expand_string
andset_multi_string
only accept one generic type. This can make them hard to use, as it means thename
andvalue
need to use the same string type. Can it be changed so that they have two generic types, one forname
and another forvalue
?New Signatures:
I came across a problem with code like this.
It was causing an error (
E0308
), becauseproviders
was aVec<String>
and the generic typeT
was&str
. I fixed by adding.to_string()
after"ProviderOrder"
. I feel like that is bad rust code, but it was the easiest way to fix it.