A cyclic dependency error in Rust occurs when two modules or crates depend on each other, preventing the compiler from resolving types. To fix this, refactor your code to extract the shared types or traits into a separate, third module that both original modules can depend on without depending on each other. For example, if module_a and module_b are cyclic, create module_shared, move the common definitions there, and have both module_a and module_b use items from module_shared instead of each other.
Error
"cyclic dependency detected" — How to Fix
Fix cyclic dependency errors in Rust by extracting shared code into a separate module that both conflicting modules can depend on.