You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bus_tests.rs
    path of file: ./repos/runng/runng/tests/tests
    
    the code of the file until where you have to start completion: use crate::common::*;
use log::{debug, trace};
use runng::{
    asyncio::*,
    options::{NngOption, SetOpts},
    socket::*,
};
use std::{
    sync::{
        atomic::{AtomicBool, AtomicUsiz
    
fn bus_sync() -> runng::Result<()> {
    const NUM_PEERS: usize = 3;
    let peer_urls: Vec<_> = (0..NUM_PEERS).map(|_| get_url()).collect();

    let done = Arc::new(AtomicBool::default());
    let msg_id = Arc::new(AtomicUsize::new(0));
    let peers_ready = Arc::new(AtomicUsize::new(0));

    let peers: Vec<_> = (0..NUM_PEERS)
        .map(|i| {
            create_peer_sync(
                peer_urls.clone(),
                i,
                done.clone(),
                peers_ready.clone(),
                msg_id.clone(),
            )
        })
        .collect();
    sleep_test();
    done.store(true, Ordering::SeqCst);

    peers
        .into_iter()
        .for_each(|thread| thread.join().unwrap().unwrap());
    // Assume every peer gets to send at least 2 messages
    assert!(msg_id.load(Ordering::SeqCst) > (NUM_PEERS + 1) * 2);

    Ok(())
}