1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (C) 2025 Christian Mauduit <ufoot@ufoot.org>
use crate*;
/// Trait for defining conditional connectivity between nodes.
///
/// `Topology` allows you to dynamically control which connections are allowed
/// in a mesh. This enables features like one-way passages, conditional doors,
/// or state-dependent pathfinding.
///
/// # Use Cases
///
/// - One-way passages (allow movement from A→B but not B→A)
/// - Doors that can open/close based on game state
/// - Conditional gates requiring keys or other conditions
/// - Dynamic environments where connectivity changes over time
///
/// # Example
///
/// ```
/// use shortestpath::mesh_topo::Topology;
///
/// // A topology that only allows movement in increasing index order (one-way)
/// struct OneWayTopology;
///
/// impl Topology for OneWayTopology {
/// fn allowed(&self, from: usize, to: usize) -> Result<bool, shortestpath::Error> {
/// Ok(to > from) // Only allow moving to higher indices
/// }
/// }
/// ```