cdns_rs/
query_private.rs

1/*-
2 * cdns-rs - a simple sync/async DNS query library
3 * 
4 * Copyright (C) 2020  Aleksandr Morozov
5 * 
6 * Copyright 2025 Aleksandr Morozov
7 * 
8 * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
9 * the European Commission - subsequent versions of the EUPL (the "Licence").
10 * 
11 * You may not use this work except in compliance with the Licence.
12 * 
13 * You may obtain a copy of the Licence at:
14 * 
15 *    https://joinup.ec.europa.eu/software/page/eupl
16 * 
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
19 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
20 * Licence for the specific language governing permissions and limitations
21 * under the Licence.
22 */
23
24use std::hash::{Hash, Hasher};
25
26use super::common::{QDnsName, QType};
27
28
29
30#[derive(Debug)]
31pub struct QDnsReq
32{
33    req_name: QDnsName,
34    qtype: QType,
35}
36
37
38impl Eq for QDnsReq {}
39
40impl PartialEq for QDnsReq
41{
42    fn eq(&self, other: &QDnsReq) -> bool 
43    {
44        return self.req_name == other.req_name;
45    }
46}
47
48impl Hash for QDnsReq
49{
50    fn hash<H: Hasher>(&self, state: &mut H) 
51    {
52        self.req_name.hash(state);
53    }
54}
55
56
57impl QDnsReq
58{
59    pub(crate)
60    fn new(req_name: QDnsName, qtype: QType) -> QDnsReq
61    {
62        return Self { req_name: req_name, qtype: qtype };
63    }
64
65    pub(crate) 
66    fn get_type(&self) -> &QType
67    {
68        return &self.qtype;
69    }
70
71    pub(crate) 
72    fn get_req_name(&self) -> &QDnsName
73    {
74        return &self.req_name;
75    }
76}
77