Pub type for Fn trait and as function argument

⚓ Rust    📅 2026-01-17    👤 surdeus    👁️ 1      

surdeus

Hello,

Unfortunately I didn't find any documentation on this subject.

So I have a pub type MyType = dyn Fn(...).

But when I write this:

pub fn some_func<F>(arg: F) where F: MyType {
    ...
}

Then I get: cannot find trait MyType in this scope.

MyType and some_func are in the same module.

Thank you very much in advance for any help.

7 posts - 2 participants

Read full topic

🏷️ Rust_feed