utils(authority): delegate

This commit is contained in:
Luna Yao
2026-04-06 02:11:04 +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"] }
cfg-if = "1.0"
delegate = "0.13.5"
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 hickory_proto::rr::{LowerName, RecordType};
use hickory_server::authority::{
@@ -23,23 +25,19 @@ where
{
type Lookup = A::Lookup;
#[inline]
fn zone_type(&self) -> ZoneType {
self.0.zone_type()
}
#[inline]
fn is_axfr_allowed(&self) -> bool {
self.0.is_axfr_allowed()
delegate! {
to self.0 {
fn zone_type(&self) -> ZoneType;
fn is_axfr_allowed(&self) -> bool;
fn origin(&self) -> &LowerName;
}
}
#[inline]
async fn update(&self, update: &MessageRequest) -> UpdateResult<bool> {
self.0.update(update).await
}
#[inline]
fn origin(&self) -> &LowerName {
self.0.origin()
}
#[inline]
async fn lookup(
&self,
name: &LowerName,
@@ -62,7 +60,7 @@ where
self.0
.lookup(name, rtype, lookup_options)
.await
.map(|l| Box::new(l) as _)
.map(|l| l.boxed() as _)
}
}
#[inline]