Can I impl public and private function but with same trait name

⚓ Rust    📅 2025-10-24    👤 surdeus    👁️ 2      

surdeus

I have problem with interface in rust. I want to hide fn b like below

trait A{
       pub fn a();
       fn b();
}

I have found some way:
example:
we can split trait A to A and Aprivate. It's have the same result but a little complicate.
or impl fn b inside trait A . It will hide fn b but It's not suiable with my purpose.
Are there any another way to do this ?

4 posts - 3 participants

Read full topic

🏷️ Rust_feed