Skip to content

Commit

Permalink
proto: fix cargo destructure
Browse files Browse the repository at this point in the history
  • Loading branch information
leshow committed Mar 7, 2021
1 parent fede858 commit 6548b6c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/client/src/error/dnssec_error.rs
Expand Up @@ -161,7 +161,7 @@ impl From<SslErrorStack> for Error {
pub mod not_openssl {
use std;

#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct SslErrorStack;

impl std::fmt::Display for SslErrorStack {
Expand All @@ -181,10 +181,10 @@ pub mod not_openssl {
pub mod not_ring {
use std;

#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct KeyRejected;

#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct Unspecified;

impl std::fmt::Display for KeyRejected {
Expand Down
8 changes: 8 additions & 0 deletions crates/proto/src/op/query.rs
Expand Up @@ -183,12 +183,20 @@ pub struct QueryParts {

impl From<Query> for QueryParts {
fn from(q: Query) -> Self {
#[cfg(feature = "mdns")]
let Query {
name,
query_type,
query_class,
mdns_unicast_response,
} = q;
#[cfg(not(feature = "mdns"))]
let Query {
name,
query_type,
query_class,
} = q;

Self {
name,
query_type,
Expand Down
11 changes: 11 additions & 0 deletions crates/proto/src/rr/resource.rs
Expand Up @@ -291,6 +291,7 @@ pub struct RecordParts {

impl From<Record> for RecordParts {
fn from(record: Record) -> Self {
#[cfg(feature = "mdns")]
let Record {
name_labels,
rr_type,
Expand All @@ -299,6 +300,16 @@ impl From<Record> for RecordParts {
rdata,
mdns_cache_flush,
} = record;

#[cfg(not(feature = "mdns"))]
let Record {
name_labels,
rr_type,
dns_class,
ttl,
rdata,
} = record;

RecordParts {
name_labels,
rr_type,
Expand Down

0 comments on commit 6548b6c

Please sign in to comment.