Skip to content

Commit 112e581

Browse files
authored
Add example of parsing field names as VariantPath (#8945)
# Which issue does this PR close? - Related to #8940 # Rationale for this change When reviewing #8940 it wasn't clear you could create a `VariantPath` from a string Thus let's add an example to the documentation # What changes are included in this PR? Add an example to the documentation # Are these changes tested? Yes, by CI # Are there any user-facing changes? Docs only, no functional change
1 parent 422eb29 commit 112e581

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

parquet-variant/src/path.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ use std::{borrow::Cow, ops::Deref};
5353
/// assert_eq!(path, path3);
5454
/// ```
5555
///
56+
/// # Example: From Dot notation strings
57+
/// ```
58+
/// # use parquet_variant::{VariantPath, VariantPathElement};
59+
/// /// You can also convert strings directly into paths using dot notation
60+
/// let path = VariantPath::from("foo.bar.baz");
61+
/// let expected = VariantPath::from("foo").join("bar").join("baz");
62+
/// assert_eq!(path, expected);
63+
/// ```
64+
///
5665
/// # Example: Accessing Compound paths
5766
/// ```
5867
/// # use parquet_variant::{VariantPath, VariantPathElement};

0 commit comments

Comments
 (0)