utils(authority): delegate

This commit is contained in:
Luna Yao
2026-04-06 11:55:25 +02:00
parent a6988e55f6
commit b7edbad4b9
2 changed files with 11 additions and 12 deletions
+1
View File
@@ -51,6 +51,7 @@ toml = "0.8.12"
chrono = { version = "0.4.37", features = ["serde"] } chrono = { version = "0.4.37", features = ["serde"] }
cfg-if = "1.0" cfg-if = "1.0"
delegate = "0.13.5"
itertools = "0.14.0" itertools = "0.14.0"
+10 -12
View File
@@ -1,3 +1,5 @@
use crate::utils::BoxExt;
use delegate::delegate;
use derive_more::{Deref, DerefMut, From}; use derive_more::{Deref, DerefMut, From};
use hickory_proto::rr::{LowerName, RecordType}; use hickory_proto::rr::{LowerName, RecordType};
use hickory_server::authority::{ use hickory_server::authority::{
@@ -23,23 +25,19 @@ where
{ {
type Lookup = A::Lookup; type Lookup = A::Lookup;
#[inline] delegate! {
fn zone_type(&self) -> ZoneType { to self.0 {
self.0.zone_type() fn zone_type(&self) -> ZoneType;
} fn is_axfr_allowed(&self) -> bool;
#[inline] fn origin(&self) -> &LowerName;
fn is_axfr_allowed(&self) -> bool { }
self.0.is_axfr_allowed()
} }
#[inline] #[inline]
async fn update(&self, update: &MessageRequest) -> UpdateResult<bool> { async fn update(&self, update: &MessageRequest) -> UpdateResult<bool> {
self.0.update(update).await self.0.update(update).await
} }
#[inline] #[inline]
fn origin(&self) -> &LowerName {
self.0.origin()
}
#[inline]
async fn lookup( async fn lookup(
&self, &self,
name: &LowerName, name: &LowerName,
@@ -62,7 +60,7 @@ where
self.0 self.0
.lookup(name, rtype, lookup_options) .lookup(name, rtype, lookup_options)
.await .await
.map(|l| Box::new(l) as _) .map(|l| l.boxed() as _)
} }
} }
#[inline] #[inline]