add missing documentation for various crates (#5950)

This commit is contained in:
Thomas Coratger
2024-01-05 14:10:37 +01:00
committed by GitHub
parent 9a25470ae2
commit 92f33b071c
24 changed files with 449 additions and 121 deletions

View File

@ -3,38 +3,59 @@ use crate::tree::TreeRootEntry;
/// Alias for a parse result
pub(crate) type ParseEntryResult<T> = Result<T, ParseDnsEntryError>;
/// Alias for lookup results
pub(crate) type LookupResult<T> = Result<T, LookupError>;
/// Error while parsing a [DnsEntry](crate::tree::DnsEntry)
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
pub enum ParseDnsEntryError {
/// Unknown entry error.
#[error("unknown entry: {0}")]
/// Indicates an unknown entry encountered during parsing.
UnknownEntry(String),
/// Field not found error.
#[error("field {0} not found")]
/// Indicates a field was not found during parsing.
FieldNotFound(&'static str),
/// Base64 decoding error.
#[error("base64 decoding failed: {0}")]
/// Indicates a failure during Base64 decoding.
Base64DecodeError(String),
/// Base32 decoding error.
#[error("base32 decoding failed: {0}")]
/// Indicates a failure during Base32 decoding.
Base32DecodeError(String),
/// RLP decoding error.
#[error("{0}")]
/// Indicates an error during RLP decoding.
RlpDecodeError(String),
/// Invalid child hash error in a branch.
#[error("invalid child hash in branch: {0}")]
/// Indicates an invalid child hash within a branch.
InvalidChildHash(String),
/// Other error.
#[error("{0}")]
/// Indicates other unspecified errors.
Other(String),
}
/// Errors that can happen during lookups
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
pub(crate) enum LookupError {
/// Parse error.
#[error(transparent)]
/// Represents errors during parsing.
Parse(#[from] ParseDnsEntryError),
/// Invalid root error.
#[error("failed to verify root {0}")]
/// Indicates failure while verifying the root entry.
InvalidRoot(TreeRootEntry),
/// Request timed out error.
#[error("request timed out")]
/// Indicates a timeout occurred during the request.
RequestTimedOut,
/// Entry not found error.
#[error("entry not found")]
/// Indicates the requested entry was not found.
EntryNotFound,
}