mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
add doc_markdown clippy lint (#8552)
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -8,7 +8,7 @@ use std::{
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Settings for the [DnsDiscoveryService](crate::DnsDiscoveryService).
|
||||
/// Settings for the [`DnsDiscoveryService`](crate::DnsDiscoveryService).
|
||||
#[derive(Debug, Clone)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub struct DnsDiscoveryConfig {
|
||||
|
||||
@ -6,7 +6,7 @@ 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)
|
||||
/// Error while parsing a [`DnsEntry`](crate::tree::DnsEntry)
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum ParseDnsEntryError {
|
||||
/// Unknown entry error.
|
||||
|
||||
@ -56,7 +56,7 @@ pub mod resolver;
|
||||
mod sync;
|
||||
pub mod tree;
|
||||
|
||||
/// [DnsDiscoveryService] front-end.
|
||||
/// [`DnsDiscoveryService`] front-end.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DnsDiscoveryHandle {
|
||||
/// Channel for sending commands to the service.
|
||||
@ -96,7 +96,7 @@ pub struct DnsDiscoveryService<R: Resolver = DnsResolver> {
|
||||
command_tx: UnboundedSender<DnsDiscoveryCommand>,
|
||||
/// Receiver half of the command channel.
|
||||
command_rx: UnboundedReceiverStream<DnsDiscoveryCommand>,
|
||||
/// All subscribers for resolved [NodeRecord]s.
|
||||
/// All subscribers for resolved [`NodeRecord`]s.
|
||||
node_record_listeners: Vec<mpsc::Sender<DnsNodeRecordUpdate>>,
|
||||
/// All the trees that can be synced.
|
||||
trees: HashMap<LinkEntry, SyncTree>,
|
||||
@ -115,7 +115,7 @@ pub struct DnsDiscoveryService<R: Resolver = DnsResolver> {
|
||||
// === impl DnsDiscoveryService ===
|
||||
|
||||
impl<R: Resolver> DnsDiscoveryService<R> {
|
||||
/// Creates a new instance of the [DnsDiscoveryService] using the given settings.
|
||||
/// Creates a new instance of the [`DnsDiscoveryService`] using the given settings.
|
||||
///
|
||||
/// ```
|
||||
/// use reth_dns_discovery::{DnsDiscoveryService, DnsResolver};
|
||||
@ -170,7 +170,7 @@ impl<R: Resolver> DnsDiscoveryService<R> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as [DnsDiscoveryService::new] but also returns a new handle that's connected to the
|
||||
/// Same as [`DnsDiscoveryService::new`] but also returns a new handle that's connected to the
|
||||
/// service
|
||||
pub fn new_pair(resolver: Arc<R>, config: DnsDiscoveryConfig) -> (Self, DnsDiscoveryHandle) {
|
||||
let service = Self::new(resolver, config);
|
||||
@ -377,7 +377,7 @@ pub struct DnsNodeRecordUpdate {
|
||||
pub enr: Enr<SecretKey>,
|
||||
}
|
||||
|
||||
/// Commands sent from [DnsDiscoveryHandle] to [DnsDiscoveryService]
|
||||
/// Commands sent from [`DnsDiscoveryHandle`] to [`DnsDiscoveryService`]
|
||||
enum DnsDiscoveryCommand {
|
||||
/// Sync a tree
|
||||
SyncTree(LinkEntry),
|
||||
@ -391,7 +391,7 @@ pub enum DnsDiscoveryEvent {
|
||||
Enr(Enr<SecretKey>),
|
||||
}
|
||||
|
||||
/// Converts an [Enr] into a [NodeRecord]
|
||||
/// Converts an [Enr] into a [`NodeRecord`]
|
||||
fn convert_enr_node_record(enr: &Enr<SecretKey>) -> Option<DnsNodeRecordUpdate> {
|
||||
let node_record = NodeRecord {
|
||||
address: enr.ip4().map(IpAddr::from).or_else(|| enr.ip6().map(IpAddr::from))?,
|
||||
|
||||
@ -62,7 +62,7 @@ impl<R: Resolver, K: EnrKeyUnambiguous> QueryPool<R, K> {
|
||||
self.queued_queries.push_back(Query::Root(Box::pin(resolve_root(resolver, link, timeout))))
|
||||
}
|
||||
|
||||
/// Resolves the [DnsEntry] for `<hash.domain>`
|
||||
/// Resolves the [`DnsEntry`] for `<hash.domain>`
|
||||
pub(crate) fn resolve_entry(&mut self, link: LinkEntry<K>, hash: String, kind: ResolveKind) {
|
||||
let resolver = Arc::clone(&self.resolver);
|
||||
let timeout = self.lookup_timeout;
|
||||
@ -153,7 +153,7 @@ pub(crate) enum QueryOutcome<K: EnrKeyUnambiguous> {
|
||||
Entry(ResolveEntryResult<K>),
|
||||
}
|
||||
|
||||
/// Retrieves the [DnsEntry]
|
||||
/// Retrieves the [`DnsEntry`]
|
||||
async fn resolve_entry<K: EnrKeyUnambiguous, R: Resolver>(
|
||||
resolver: Arc<R>,
|
||||
link: LinkEntry<K>,
|
||||
|
||||
@ -33,7 +33,7 @@ impl<P: ConnectionProvider> Resolver for AsyncResolver<P> {
|
||||
|
||||
/// An asynchronous DNS resolver
|
||||
///
|
||||
/// See also [TokioAsyncResolver]
|
||||
/// See also [`TokioAsyncResolver`]
|
||||
///
|
||||
/// ```
|
||||
/// # fn t() {
|
||||
@ -43,7 +43,7 @@ impl<P: ConnectionProvider> Resolver for AsyncResolver<P> {
|
||||
/// ```
|
||||
///
|
||||
/// Note: This [Resolver] can send multiple lookup attempts, See also
|
||||
/// [ResolverOpts](trust_dns_resolver::config::ResolverOpts) which configures 2 attempts (1 retry)
|
||||
/// [`ResolverOpts`](trust_dns_resolver::config::ResolverOpts) which configures 2 attempts (1 retry)
|
||||
/// by default.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DnsResolver(TokioAsyncResolver);
|
||||
@ -51,7 +51,7 @@ pub struct DnsResolver(TokioAsyncResolver);
|
||||
// === impl DnsResolver ===
|
||||
|
||||
impl DnsResolver {
|
||||
/// Create a new resolver by wrapping the given [AsyncResolver]
|
||||
/// Create a new resolver by wrapping the given [`AsyncResolver`]
|
||||
pub const fn new(resolver: TokioAsyncResolver) -> Self {
|
||||
Self(resolver)
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ pub(crate) enum SyncAction {
|
||||
Link(String),
|
||||
}
|
||||
|
||||
/// How the [SyncTree::update_root] changed the root
|
||||
/// How the [`SyncTree::update_root`] changed the root
|
||||
enum SyncState {
|
||||
RootUpdate,
|
||||
Pending,
|
||||
|
||||
Reference in New Issue
Block a user