Decycler
struct · ferroui-base · v0.5.0
struct Decycler<T: Copy + Eq + Hash>
Tracks visited nodes to detect cycles in a graph (composite glyphs, paint graphs, etc.). Uses a depth limit to prevent stack overflow during recursive traversal.
The intended usage pattern is "one instance per traversal": rent an instance from a pool at the start of a walk and return it when done.
enter reports cycle / depth-limit failures as errors.
Callers that traverse user-supplied data (e.g. font tables) should treat
the failure as "stop traversing this subgraph".
Members
new
fn new(max_depth: i32) -> Self
Creates a new decycler with the specified maximum depth.
Panics when max_depth is less than 1.
enter
fn enter(self: &Self, id: T) -> Result<CycleGuard<'_, T>, DecyclerException>
Attempts to enter a node with the given ID. Returns a guard that exits the node when dropped.
current_depth
fn current_depth(self: &Self) -> i32
Returns the current traversal depth.
max_depth
fn max_depth(self: &Self) -> i32
Returns the maximum allowed traversal depth.
reset
fn reset(self: &Self)
Resets the decycler to its initial state, clearing all visited nodes.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.