`add_string_variable` removed
I'm updating my project to your recent version that utilizes the fork of HDF5, but am running into an error that add_string_variable has been removed. I don't see a changelog, and a cursory look around doesn't indicate an obvious replacement.
Before I had something like:
let mut reim = file.add_string_variable("reim", &["reim"])?;
reim.put_attribute("long_name", "Complex")?;
reim.put_string("real", 0)?;
reim.put_string("imaginary", 1)?;
which now doesn't work. Any help would be appreciated.
add_string_variable was removed in preference to typing out the netCDF type explicitely. You can use the below as a replacement
let mut reim = file.add_variable_with_type("reim", &["reim"], &netcdf::types::NcVariableType::String)?;
reim.put_attribute("long_name", "Complex")?;
reim.put_string("real", 0)?;
reim.put_string("imaginary", 1)?;
This seems regressive, what's the motivation for not having the convenience constructor?
This was removed at the same time as support for user-defined types were added. It felt redundant at the time to have so many constructors
I also was confused by the removal of this function, especially without a changelog to see recommended migrations.
Personally, I find that string variables are common enough that the convenience constructor is worthwhile (compared to, say, vlen types). But, if the decision is to simplify the number of constructors, then an example should be added to the documentation. For me, I would look for that example either at the top of the crate (with the other simple examples) or in the FileMut and GroupMut sections.