You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature fields getters and setters should accept field indexes #500
Well, a resolution from name to index is a convenience thing, I guess. There could be two separate methods or one that accepts both. But you definitely need the opportunity to use the names.
So we can add fn set_field_by_index(&self, idx: usize, value: &FieldValue), fn set_field_integer_by_index(&self, idx: usize, value: i32) and about 9 more.
But I'm worried that users will just do:
for feature in layer.features(){
feature.set_field_integer("foo",20);}
instead of:
let foo_col = layer.field_index("foo")?;for feature in layer.features(){
feature.set_field_integer_by_index(foo_col,20);}
Activity
ChristianBeilschmidt commentedon Jan 30, 2024
Well, a resolution from name to index is a convenience thing, I guess. There could be two separate methods or one that accepts both. But you definitely need the opportunity to use the names.
So, what is your suggestion here?
lnicola commentedon Jan 30, 2024
So we can add
fn set_field_by_index(&self, idx: usize, value: &FieldValue),fn set_field_integer_by_index(&self, idx: usize, value: i32)and about 9 more.But I'm worried that users will just do:
instead of:
just because it's easier to find.
ChristianBeilschmidt commentedon Feb 4, 2024
Yeah, either it would be
…by_indexand…by_nameseparately or you just have to keep strongly typing it to size 😄 .