make errors generic in DnsHandle for Resolver

This commit is contained in:
Benjamin Fry
2020-09-07 10:17:01 -07:00
parent 48f625ad0d
commit 248fd8709b
26 changed files with 490 additions and 270 deletions

View File

@@ -7,9 +7,9 @@
use std::future::Future;
use trust_dns_resolver::proto::error::ProtoError;
use trust_dns_resolver::proto::Executor;
use trust_dns_resolver::error::ResolveError;
use trust_dns_resolver::name_server::{
GenericConnection, GenericConnectionProvider, RuntimeProvider, Spawn,
};
@@ -62,7 +62,7 @@ pub struct AsyncStdRuntimeHandle;
impl Spawn for AsyncStdRuntimeHandle {
fn spawn_bg<F>(&mut self, future: F)
where
F: Future<Output = Result<(), ProtoError>> + Send + 'static,
F: Future<Output = Result<(), ResolveError>> + Send + 'static,
{
let _join = async_std::task::spawn(future);
}

View File

@@ -7,6 +7,7 @@ use crate::proto::xfer::DnsRequest;
use crate::proto::Executor;
use crate::runtime::{AsyncStdConnection, AsyncStdRuntime};
use crate::AsyncStdResolver;
use crate::ResolveError;
fn is_send_t<T: Send>() -> bool {
true
@@ -27,8 +28,8 @@ fn test_send_sync() {
assert!(is_sync_t::<AsyncStdResolver>());
assert!(is_send_t::<DnsRequest>());
assert!(is_send_t::<LookupIpFuture<AsyncStdConnection>>());
assert!(is_send_t::<LookupFuture<AsyncStdConnection>>());
assert!(is_send_t::<LookupIpFuture<AsyncStdConnection, ResolveError>>());
assert!(is_send_t::<LookupFuture<AsyncStdConnection, ResolveError>>());
}
#[test]