pub mod dns_class;
pub mod domain;
mod lower_name;
pub mod rdata;
pub mod record_data;
pub mod record_type;
pub(crate) mod record_type_set;
pub mod resource;
mod rr_key;
mod rr_set;
pub mod serial_number;
use core::fmt::{Debug, Display};
use crate::{
error::ProtoResult,
serialize::binary::{BinDecodable, BinDecoder, BinEncodable, Restrict},
};
pub use self::dns_class::DNSClass;
pub use self::domain::{IntoName, Name};
pub use self::record_data::RData;
pub use self::record_type::RecordType;
pub(crate) use self::record_type_set::RecordTypeSet;
pub use self::resource::Record;
#[allow(deprecated)]
pub use self::rr_set::IntoRecordSet;
pub use self::rr_set::RecordSet;
pub use self::rr_set::RrsetRecords;
pub use lower_name::LowerName;
pub use rr_key::RrKey;
pub use serial_number::SerialNumber;
pub trait RecordData: Clone + Sized + PartialEq + Eq + Display + Debug + BinEncodable {
#[allow(clippy::result_large_err)]
fn try_from_rdata(data: RData) -> Result<Self, RData>;
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>) -> ProtoResult<Self>;
}
impl<'r, T> RecordDataDecodable<'r> for T
where
T: 'r + BinDecodable<'r> + Sized,
{
fn read_data(decoder: &mut BinDecoder<'r>, _length: Restrict<u16>) -> ProtoResult<Self> {
T::read(decoder)
}
}