alamb opened a new issue, #7756: URL: https://github.com/apache/arrow-rs/issues/7756
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** After @scovich's PR to validate objects on construction - https://github.com/apache/arrow-rs/pull/7704 I expected to be able to use the APIs for variant without havin to check for errors. Also I found the `field_by_name` very confusing as I expected `get()` to retrieve a field of a Variant object but instead it was called `field_by_name`. **Describe the solution you'd like** I want APIs that are infallible (don't return errors) so they are easier to work with **Describe alternatives you've considered** I would personally like to write ```rust let variant_object = variant.as_object().unwrap() // retrieve the value from a field as Option<Variant> assert_eq!(variant_object.get("my_field"), Some(Variant::from("foo"))); // non existent fields return None assert_eq!(variant_object.get("my_non_existent)field"), None); ``` Likewise for VariantLists I would like to do ```rust let variant_list = variant.as_list().unwrap(); // retrieve item at index 1 assert_eq!(variant_list.get(1), Some(Variant::from("foo"))); /// non existent items return None (like Rust slices) assert_eq!(variant_list.get(100), None); ``` **Additional context** I noticed this while working on - https://github.com/apache/arrow-rs/pull/7755 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
