You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2025/07/28 21:20:32 UTC
Re: [PR] [Variant] impl FromIterator for VariantPath [arrow-rs]
alamb commented on code in PR #8011:
URL: https://github.com/apache/arrow-rs/pull/8011#discussion_r2237885501
##########
parquet-variant/src/path.rs:
##########
@@ -43,10 +43,10 @@ use std::{borrow::Cow, ops::Deref};
/// // access the field "foo" and then the first element in a variant list value
/// let path = VariantPath::from("foo").join(0);
/// // this is the same as the previous one
-/// let path2 = VariantPath::new(vec!["foo".into(), 0.into()]);
+/// let path2 = VariantPath::from_iter(["foo".into(), 0.into()]);
/// assert_eq!(path, path2);
/// // you can also create a path from a vector of `VariantPathElement` directly
-/// let path3 = VariantPath::new(vec![
+/// let path3 = VariantPath::from_iter([
/// VariantPathElement::field("foo"),
/// VariantPathElement::index(0)
/// ]);
Review Comment:
Maybe we could show using the `collect` syntax too -- something like
```suggestion
/// let path3 = [
/// VariantPathElement::field("foo"),
/// VariantPathElement::index(0)
/// ].into_iter().collect::<VariantPath>()
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org