pub fn spawn() -> (Arc<Mutex<AddressBook>>, mpsc::Sender<MetaAddr>) {
        use tracing::Level;
        const TIMESTAMP_WORKER_BUFFER_SIZE: usize = 100;
        let (worker_tx, mut worker_rx) = mpsc::channel(TIMESTAMP_WORKER_BUFFER_SIZE);
        let address_book = Arc::new(Mutex::new(AddressBook::new(span!(
            Level::TRACE,
            "timestamp collector"
        ))));
        let worker_address_book = address_book.clone();

        let worker = async move {
            while let Some(event) = worker_rx.next().await {
                worker_address_book
                    .lock()
                    .expect("mutex should be unpoisoned")
                    .update(event);
            }
        };
        tokio::spawn(worker.boxed());

        (address_book, worker_tx)
    }
/// Spawn a new [`TimestampCollector`] task, and return handles for the
/// transmission channel for timestamp events and for the [`AddressBook`] it
/// updates.
Spawn a new [`TimestampCollector`] task, and return handles for the
transmission channel for timestamp events and for the [`AddressBook`] it
updates.
Spawn a new [ ` TimestampCollector ` ] task and return handles for the transmission channel for timestamp events and for the [ ` AddressBook ` ] it updates .
pub fn spawn() -> (Arc<Mutex<AddressBook>>, mpsc::Sender<MetaAddr>) {
        use tracing::Level;
        const TIMESTAMP_WORKER_BUFFER_SIZE: usize = 100;
        let (worker_tx, mut worker_rx) = mpsc::channel(TIMESTAMP_WORKER_BUFFER_SIZE);
        let address_book = Arc::new(Mutex::new(AddressBook::new(span!(
            Level::TRACE,
            "timestamp collector"
        ))));
        let worker_address_book = address_book.clone();
        let worker = async move {
            while let Some(event) = worker_rx.next().await {
                worker_address_book
                    .lock()
                    .expect("mutex should be unpoisoned")
                    .update(event);
            }
        };
        tokio::spawn(worker.boxed());
        (address_book, worker_tx)
    }
pub fn spawn ( ) -> ( Arc < Mutex < AddressBook > > , mpsc :: Sender < MetaAddr > ) { use tracing :: Level ; const TIMESTAMP_WORKER_BUFFER_SIZE : usize = 100 ; let ( worker_tx , mut worker_rx ) = mpsc :: channel ( TIMESTAMP_WORKER_BUFFER_SIZE ) ; let address_book = Arc :: new ( Mutex :: new ( AddressBook :: new ( span ! ( Level TRACE " " ) ) ) ) ; let worker_address_book = address_book . clone ( ) ; let worker = async move { while let Some ( event ) = worker_rx . next ( ) . await { worker_address_book . lock ( ) . expect ( " " ) . update ( event ) ; } } ; tokio :: spawn ( worker . boxed ( ) ) ; ( address_book , worker_tx ) }
Spawn a new [`TimestampCollector`] task, and return handles for the
transmission channel for timestamp events and for the [`AddressBook`] it
updates.
Spawn a new [ ` TimestampCollector ` ] task and return handles for the transmission channel for timestamp events and for the [ ` AddressBook ` ] it updates .