Crossbeam example not quite right?

I have been looking here:

The example has:

use crossbeam_channel::unbounded;

However I think it needs to be

use crossbeam::channel::unbounded;

Maybe an "obvious" silly mistake ( I guess some renaming went on ), but it had me quite confused for a while. Or is it me that is confused?!

The thing is, crossbeam_channel is its own crate, which can be used standalone. It is also included by crossbeam and re-exported as crossbeam::channel.

So what you see there is the documentation of the standalone crate, for which the example is correctly written. I'm not sure how to address/fix this :frowning:

2 Likes

Oh, I see. So the example it will depend on which crate you choose? Ok, I am bit too new to Rust to suggest a possible solution, but it did confuse me. Maybe a note somewhere to explain the situation?

Yes, basically. You could raise an issue in the crossbeam repo about this.

1 Like

I suppose this cannot be easily fixed, in fact. The reason is that crossbeam crate doesn't hold any documentation on channel - it copies the one from crossbeam_channel, since it is the reexport, not the containment.

Still, since they are "friendly" crates in the same namespace, the example could have a comment noting
// If you use this crate via `crossbeam::channel`, yadda yadda...

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.