Struct Path
pub struct Path {
pub root: PathRoot,
pub projection: Projection,
}Expand description
A rooted field traversal path through the application schema.
A Path starts at a PathRoot (a model or an enum variant) and
navigates through fields via a Projection. It is used by the query
engine to identify which field or nested field is being referenced.
§Examples
use toasty_core::stmt::Path;
use toasty_core::schema::app::ModelId;
// Path pointing to the root of model 0
let p = Path::model(ModelId::from_index(0));
assert!(p.is_empty()); // no field stepsFields§
§root: PathRootWhere the path originates from.
projection: ProjectionTraversal through the fields.
Implementations§
§impl Path
impl Path
pub fn model(root: impl Into<ModelId>) -> Path
pub fn model(root: impl Into<ModelId>) -> Path
Creates a path rooted at a model with an identity projection (no field steps).
pub fn field(root: impl Into<ModelId>, field: usize) -> Path
pub fn field(root: impl Into<ModelId>, field: usize) -> Path
Creates a path rooted at a model that navigates to a single field by index.
pub const fn from_index(root: ModelId, index: usize) -> Path
pub const fn from_index(root: ModelId, index: usize) -> Path
Creates a path rooted at a model with a single field step (const-compatible).
pub fn from_variant(parent: Path, variant_id: VariantId) -> Path
pub fn from_variant(parent: Path, variant_id: VariantId) -> Path
Creates a path rooted at a specific enum variant.
parent is the path that navigates to the enum field. Subsequent
projection steps (appended via chain) index into the
variant’s fields using 0-based local indices.