How to handle dependencies for library?

In my app, which I want to make a library, I have a dependency:

use async_broadcast::{broadcast, Sender as BroadcastSender, Receiver as BroadcastReceiver};

And I want to make next struct be importable:

pub struct RunOptions {
    query_sender: BroadcastSender<HandlerOutput>,
    query_receiver: BroadcastReceiver<HandlerOutput>,
}

Could somebody explain, what should I do to make external app auto-install async_broadcast, so it will be possible to use RunOptions from outside ?

Assuming you've imported async_broadcast as a Cargo dependency, you don't have to do anything. It just works.

1 Like