scovich commented on code in PR #7942: URL: https://github.com/apache/arrow-rs/pull/7942#discussion_r2213970123
########## parquet-variant/src/path.rs: ########## @@ -16,18 +16,77 @@ // under the License. use std::{borrow::Cow, ops::Deref}; -/// Represents a qualified path to a potential subfield or index of a variant value. -#[derive(Debug, Clone)] +/// Represents a qualified path to a potential subfield or index of a variant +/// value. +/// +/// Can be used with [`Variant::get_path`] to retrieve a specific subfield of +/// a variant value. +/// +/// [`Variant::get_path`]: crate::Variant::get_path +/// +/// Create a [`VariantPath`] from a vector of [`VariantPathElement`], or +/// from a single field name or index. +/// +/// # Example: Simple paths +/// ```rust +/// # use parquet_variant::{VariantPath, VariantPathElement}; +/// // access the field "foo" in a variant object value +/// let path = VariantPath::from("foo"); +/// // access the first element in a variant list vale +/// let path = VariantPath::from(0); +/// ``` +/// +/// # Example: Compound paths +/// ``` +/// # use parquet_variant::{VariantPath, VariantPathElement}; +/// /// You can also create a path by joining elements together: +/// // 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()]); +/// assert_eq!(path, path2); +/// // you can also create a path from a vector of `VariantPathElement` directly +/// let path3 = VariantPath::new(vec![ +/// VariantPathElement::field("foo"), +/// VariantPathElement::index(0) +/// ]); Review Comment: Should it also `impl FromIterator` so people can do: ```rust VariantPath::from_iter(["foo".into(), 0.into()]) ``` or ```rust ["foo".into(), 0.into()].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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org