Skip to main content

Module path

Module path 

Source
Expand description

Dot-separated path type for navigating nested syn metadata. Dot-separated path type for navigating nested syn metadata.

[MetaPath] parses strings like "serde.rename" or "derive[0]" into a sequence of [Segment]s that can be used to drill into nested syn::Meta structures.

§Syntax

  • . separates key segments
  • [N] is a positional index into list items
  • The first segment is always a key

§Examples

use zyn::path::MetaPath;

let path: MetaPath = "serde.rename".parse().unwrap();
assert_eq!(path.segments().len(), 2);

let path: MetaPath = "derive[0]".parse().unwrap();
// → [Key("derive"), Index(0)]

let path: MetaPath = "serde.container[1].value".parse().unwrap();
// → [Key("serde"), Key("container"), Index(1), Key("value")]

Structs§

MetaPath
A parsed dot-separated path for navigating nested syn metadata.

Enums§

ParseError
An error that occurs when parsing a MetaPath.
Segment
A single segment in a MetaPath.