nonymous 0.7.0

DNS protocol and algorithm library
Documentation
#![forbid(unsafe_code)]
#![cfg_attr(ci_, deny(warnings))]
#![cfg_attr(all(test, feature = "bench"), feature(test))]
#![cfg_attr(not(feature = "std"), no_std)]
// #![warn(missing_docs)]

#[cfg(feature = "alloc")]
extern crate alloc;

macro_rules! error {
    ($name:ident $(($($before:ident, )* [$source:ident: $x:expr] $(, $after:ident)*))? $(, $variant:ident)*) => {
        impl ::core::error::Error for $name {
            fn source(&self) -> Option<&(dyn ::core::error::Error + 'static)> {
                match self {
                    $($name($($before, )* $source $(, $after)*) => Some($x),)?
                    $($name::$variant(s) => Some(s),)*

                    #[allow(unreachable_patterns)]
                    _ => None,
                }
            }
        }
    };
}

/// Declare an enum with the given `$name` as the sum of all error types in this library.
/// This should only be used in doctests.
// FIXME rust-lang/rust#67295
// #[cfg(any(test, doctest))]
#[macro_export]
#[doc(hidden)]
macro_rules! declare_any_error {
    (@real ($($(#[$meta:meta])* $variant:ident $ty:ty,)+)) => {
        #[derive(Debug)]
        #[allow(unused)]
        pub enum AnyError {
            $($(#[$meta])* $variant($ty),)+
        }

        $(
            $(#[$meta])*
            impl From<$ty> for AnyError {
                fn from(e: $ty) -> Self { Self::$variant(e) }
            }
        )+
    };

    (@real ($($done:tt)*) $(#[$meta:meta])* ($($path:tt)+)($name:ident), $($rest:tt)*) => {
        $crate::declare_any_error!(@real ($($done)* $(#[$meta])* $name $($path)+::$name,) $($rest)*);
    };

    (@real ($($done:tt)*) $(#[$meta:meta])* ($($path:tt)+)($name:ident) as $variant:ident, $($rest:tt)*) => {
        $crate::declare_any_error!(@real ($($done)* $(#[$meta])* $variant $($path)+::$name,) $($rest)*);
    };

    ($name:ident) => {
        $crate::declare_any_error!(
            @real ()
            (::core::convert)(Infallible),
            ($crate::view)(BoundsError),
            ($crate::view)(MessageError),
            ($crate::view)(QuestionError),
            ($crate::view)(RecordError),
            ($crate::view)(NameError),
            ($crate::view)(LabelError),
            ($crate::view)(ExtensionError),
            ($crate::emit)(SinkError),
            ($crate::emit)(GrowError),
            ($crate::emit::extension)(ExtensionError) as EmitExtensionError,
            ($crate::emit::message)(MessageError) as EmitMessageError,
            ($crate::emit::name)(NameError) as EmitNameError,
            ($crate::emit::question)(QuestionError) as EmitQuestionError,
            ($crate::emit::record)(RecordError) as EmitRecordError,
            ($crate::core)(OpcodeRangeError),
            ($crate::core)(RcodeRangeError),
            ($crate::core)(TypeFromStrError),
            ($crate::core)(ClassFromStrError),
            ($crate::core)(TtlFromStrError),
            ($crate::name)(OwnedNameError),
            ($crate::rdata::view::error)(RdataError),
            ($crate::rdata::view::error)(SoaError),
            ($crate::rdata::view::error)(TypedRdataError),
            ($crate::server)(ResponseError),
            (::core::fmt)(Error),
        );
    };
}

#[macro_use]
pub mod core;
pub mod emit;
pub mod fmt;
pub mod name;
pub mod rdata;
pub mod server;
pub mod view;

mod seen;

pub const MAX_SUPPORTED_EDNS_VERSION: u8 = 0;