jorgecarleitao commented on a change in pull request #680:
URL: https://github.com/apache/arrow-rs/pull/680#discussion_r687054258



##########
File path: arrow/src/array/array_string.rs
##########
@@ -196,11 +196,26 @@ impl<OffsetSize: StringOffsetSizeTrait> 
GenericStringArray<OffsetSize> {
     }
 }
 
+impl<'a, Ptr, OffsetSize: StringOffsetSizeTrait> FromIterator<&'a Option<Ptr>>
+    for GenericStringArray<OffsetSize>
+where
+    Ptr: AsRef<str> + 'a,
+{
+    /// Creates a `GenericStringArray` based on an iterator of `Option` 
references.
+    fn from_iter<I: IntoIterator<Item = &'a Option<Ptr>>>(iter: I) -> Self {
+        // Convert each owned Ptr into &str and wrap in an owned `Option`
+        let iter = iter.into_iter().map(|o| o.as_ref().map(|p| p.as_ref()));
+        // Build a `GenericStringArray` with the resulting iterator
+        iter.collect::<GenericStringArray<OffsetSize>>()
+    }
+}
+
 impl<'a, Ptr, OffsetSize: StringOffsetSizeTrait> FromIterator<Option<Ptr>>
     for GenericStringArray<OffsetSize>
 where
     Ptr: AsRef<str>,
 {
+    /// Creates a `GenericStringArray` based on an iterator of `Option`s

Review comment:
       ```suggestion
       /// Creates a [`GenericStringArray`] based on an iterator of `Option`s
   ```

##########
File path: arrow/src/array/array_string.rs
##########
@@ -196,11 +196,26 @@ impl<OffsetSize: StringOffsetSizeTrait> 
GenericStringArray<OffsetSize> {
     }
 }
 
+impl<'a, Ptr, OffsetSize: StringOffsetSizeTrait> FromIterator<&'a Option<Ptr>>
+    for GenericStringArray<OffsetSize>
+where
+    Ptr: AsRef<str> + 'a,
+{
+    /// Creates a `GenericStringArray` based on an iterator of `Option` 
references.

Review comment:
       ```suggestion
       /// Creates a [`GenericStringArray`] based on an iterator of `Option` 
references.
   ```




-- 
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]


Reply via email to