1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::blockchain::Ref;
use std::sync::Arc;

/// the data that is contained in a branch
#[derive(Clone)]
pub struct Branch {
    /// reference to the block where the branch points to
    reference: Arc<Ref>,
}

impl Branch {
    /// create the branch data with the current `last_updated` to
    /// the current time this function was called
    pub fn new(reference: Arc<Ref>) -> Self {
        Branch { reference }
    }

    pub fn get_ref(&self) -> Arc<Ref> {
        Arc::clone(&self.reference)
    }

    pub fn into_ref(self) -> Arc<Ref> {
        self.reference
    }
}