Skip to main content

Module tree

Module tree 

Source
Expand description

Materialized-path encoding for the page tree.

A page’s path is its ancestors’ row ids as hex segments followed by its own, so ORDER BY path is a depth-first walk and a subtree is one prefix range. This module only builds and parses paths; tree mutations live in crate::tree_ops.

Structs§

MaterializedPath
Helper for building, parsing, and querying materialized paths.

Enums§

PathError

Constants§

SEGMENT_WIDTH
Width of a materialized-path segment for ids up to 65 535: 4 hex chars.
SEPARATOR
WIDE_MARKER
Marks a segment for an id above 65 535. ~ sorts after every hex digit, so wide siblings order after narrow ones and by id among themselves; like any segment it ends in SEPARATOR, which sorts below every digit, so a subtree stays contiguous under ORDER BY path.
WIDE_WIDTH
Hex width of a wide segment: ids up to u32::MAX.

Functions§

depth_of
Compute depth from a raw path string. Trailing-slash safe.
descendants_like
SQL LIKE pattern matching every descendant of parent_path — and the parent itself, since % matches the empty string. Callers that want descendants only add path != parent_path.
parent_of
Strip the last segment, returning the parent prefix (with trailing /), or None if the path was already a single segment.