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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use super::Class;
use crate::DomainName;
use std::fmt::{Display, Formatter, Result as FmtResult};

/// The [location information] resource record type.
///
/// [location information]: https://tools.ietf.org/html/rfc1876#section-2
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct LOC {
    pub domain_name: DomainName,
    pub ttl: u32,
    pub class: Class,
    pub version: u8,
    pub size: u8,
    pub horiz_pre: u8,
    pub vert_pre: u8,
    pub latitube: u32,
    pub longitube: u32,
    pub altitube: u32,
}

impl_to_type!(LOC);

impl Display for LOC {
    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
        write!(
            f,
            "{} {} {} LOC {} {} {} {} {} {} {}",
            self.domain_name,
            self.ttl,
            self.class,
            self.version,
            self.size,
            self.horiz_pre,
            self.vert_pre,
            self.latitube,
            self.longitube,
            self.altitube,
        )
    }
}