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: metrics.rs
    path of file: ./repos/bee/bee-protocol/bee-protocol/src
    
    the code of the file until where you have to start completion: // Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use std::{convert::Infallible, time::Duration};

use async_trait::async_trait;
use bee_ledger::event::{MilestoneConfirmed, PrunedIndex, SnapshottedIndex};
use bee_runtime::{node::Node, shutdown_stream::ShutdownStream, worker::Worker};
use futures::StreamExt;
use log::info;
use tokio::time::interval;
use tokio_stream::wrappers::IntervalStream;

use crate::types::metrics::NodeMetrics;

const METRICS_INTERVAL: Duration = Duration::from_secs(60);

pub struct MetricsWorker {}

#[async_trait]
impl<N: Node> Worker<N> for MetricsWorker {
    type Config = ();
    type Error = Infallible;

    async fn start(node: &mut N, _config: Self::Config) -> Result<Self, Self::Error> {
        node.register_resource(NodeMetrics::new());

        let metrics = node.resource::<NodeMetrics>();
        node.bus().add_listener::<Self, MilestoneConfirmed, _>(move |event| {
            metrics.referenced_blocks_inc(event.referenced_blocks as u64
    
    async fn start(node: &mut N, _config: Self::Config) -> Result<Self, Self::Error> {
        node.register_resource(NodeMetrics::new());

        let metrics = node.resource::<NodeMetrics>();
        node.bus().add_listener::<Self, MilestoneConfirmed, _>(move |event| {
            metrics.referenced_blocks_inc(event.referenced_blocks as u64);
            metrics.excluded_no_transaction_blocks_inc(event.excluded_no_transaction_blocks.len() as u64);
            metrics.excluded_conflicting_blocks_inc(event.excluded_conflicting_blocks.len() as u64);
            metrics.included_blocks_inc(event.included_blocks.len() as u64);
            metrics.created_outputs_inc(event.created_outputs as u64);
            metrics.consumed_outputs_inc(event.consumed_outputs as u64);
            metrics.receipts_inc(event.receipt as u64);
        });

        let metrics = node.resource::<NodeMetrics>();
        node.bus().add_listener::<Self, SnapshottedIndex, _>(move |_| {
            metrics.snapshots_inc(1);
        });

        let metrics = node.resource::<NodeMetrics>();
        node.bus().add_listener::<Self, PrunedIndex, _>(move |_| {
            metrics.prunings_inc(1);
        });

        let metrics = node.resource::<NodeMetrics>();

        node.spawn::<Self, _, _>(|shutdown| async move {
            info!("Running.");

            let mut ticker = ShutdownStream::new(shutdown, IntervalStream::new(interval(METRICS_INTERVAL)));

            while ticker.next().await.is_some() {
                info!("{:?}", *metrics);
            }

            info!("Stopped.");
        });

        Ok(Self {})
    }