1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
/// A metric source ID.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Oid(u64);

impl Oid {
    /// Creates a new OID.
    pub fn new(id: u64) -> Self {
        Oid(id)
    }
    
    /// Gets a representation of the OID for use in a URL path.
    pub fn as_url_part(&self) -> String {
        format!("{}", self.0)
    }
}

impl From<u64> for Oid {
    fn from(val: u64) -> Self {
        Oid::new(val)
    }
}