pub struct PathStep {
pub direction: Direction,
pub filter: StepFilter,
pub min_hops: usize,
pub max_hops: Option<usize>,
}Expand description
A single step in a path pattern.
Each step specifies a direction, edge filter, and optional hop range.
Fields§
§direction: DirectionDirection to traverse for this step.
filter: StepFilterFilter for edges in this step.
min_hops: usizeMinimum number of hops (default: 1).
max_hops: Option<usize>Maximum number of hops (default: 1).
Use None for unlimited (variable length patterns).
Implementations§
Source§impl PathStep
impl PathStep
Sourcepub fn new(direction: Direction, filter: impl Into<StepFilter>) -> Self
pub fn new(direction: Direction, filter: impl Into<StepFilter>) -> Self
Create a new single-hop step.
Sourcepub fn any(direction: Direction) -> Self
pub fn any(direction: Direction) -> Self
Create a step that matches any edge in the given direction.
Sourcepub fn outgoing(edge_type: impl Into<EdgeType>) -> Self
pub fn outgoing(edge_type: impl Into<EdgeType>) -> Self
Create an outgoing step with the given edge type.
Sourcepub fn incoming(edge_type: impl Into<EdgeType>) -> Self
pub fn incoming(edge_type: impl Into<EdgeType>) -> Self
Create an incoming step with the given edge type.
Sourcepub fn both(edge_type: impl Into<EdgeType>) -> Self
pub fn both(edge_type: impl Into<EdgeType>) -> Self
Create a bidirectional step with the given edge type.
Sourcepub const fn with_hops(self, min: usize, max: Option<usize>) -> Self
pub const fn with_hops(self, min: usize, max: Option<usize>) -> Self
Set the hop range for this step.
§Arguments
min- Minimum number of hopsmax- Maximum number of hops (None for unlimited)
Sourcepub const fn variable_length(self, min: usize, max: usize) -> Self
pub const fn variable_length(self, min: usize, max: usize) -> Self
Make this a variable-length step with the given range.
Equivalent to Cypher’s *min..max syntax.
Sourcepub const fn zero_or_more(self) -> Self
pub const fn zero_or_more(self) -> Self
Make this step repeat any number of times (0 or more).
Sourcepub const fn one_or_more(self) -> Self
pub const fn one_or_more(self) -> Self
Make this step repeat one or more times.
Sourcepub fn is_variable_length(&self) -> bool
pub fn is_variable_length(&self) -> bool
Check if this step is variable length.