use core::fmt::{Debug, Display};
use crate::serialize::binary::{BinDecodable, BinDecoder, BinEncodable, DecodeError, Restrict};
pub(crate) mod dns_class;
pub use dns_class::DNSClass;
pub mod domain;
pub use domain::{IntoName, Label, Name};
mod lower_name;
pub use lower_name::LowerName;
pub mod rdata;
pub(crate) mod record;
pub use record::{Record, RecordRef};
pub(crate) mod record_data;
pub use record_data::RData;
pub(crate) mod record_type;
pub use record_type::RecordType;
pub(crate) mod record_type_set;
pub use record_type_set::RecordTypeSet;
mod rr_key;
pub use rr_key::RrKey;
mod rr_set;
#[cfg(feature = "__dnssec")]
pub use rr_set::RecordsAndRrsigsIter;
pub use rr_set::{RecordSet, RecordSetParts, RrsetRecords};
pub(crate) mod serial_number;
pub use serial_number::SerialNumber;
mod tsig;
#[cfg(feature = "__dnssec")]
pub use tsig::TSigVerifier;
pub use tsig::{TSigResponseContext, TSigner};
pub trait RecordData: Clone + Sized + PartialEq + Eq + Display + Debug + BinEncodable {
fn try_borrow(data: &RData) -> Option<&Self>;
fn record_type(&self) -> RecordType;
fn into_rdata(self) -> RData;
fn is_update(&self) -> bool {
false
}
}
pub(crate) trait RecordDataDecodable<'r>: Sized {
fn read_data(decoder: &mut BinDecoder<'r>, length: Restrict<u16>) -> Result<Self, DecodeError>;
}
impl<'r, T> RecordDataDecodable<'r> for T
where
T: 'r + BinDecodable<'r> + Sized,
{
fn read_data(
decoder: &mut BinDecoder<'r>,
_length: Restrict<u16>,
) -> Result<Self, DecodeError> {
T::read(decoder)
}
}