Function tdn::prelude::start_with_config
source ยท pub async fn start_with_config(
config: Config
) -> Result<(PeerId, Sender<SendMessage>, Receiver<ReceiveMessage>)>
Expand description
start a service with config.
Examples found in repository?
examples/app_with_config_file.rs (line 10)
5 6 7 8 9 10 11 12 13 14 15 16 17 18
async fn main() {
// use crate root directory's config.toml
let dir_path = PathBuf::from(".");
let config = Config::load(dir_path).await;
let (peer_addr, _send, mut out_recv) = start_with_config(config).await.unwrap();
println!("Example: peer id: {}", peer_addr.short_show());
while let Some(message) = out_recv.recv().await {
match message {
_ => {}
}
}
}