FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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".

    View source

    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.

    Source

    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.

    Source

    current_depth

    fn current_depth(self: &Self) -> i32
    

    Returns the current traversal depth.

    Source

    max_depth

    fn max_depth(self: &Self) -> i32
    

    Returns the maximum allowed traversal depth.

    Source

    reset

    fn reset(self: &Self)
    

    Resets the decycler to its initial state, clearing all visited nodes.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.