From 0321ea043d29f950f9d951daf038439e7b8fcee0 Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Sat, 21 Nov 2020 22:10:37 -0800 Subject: [PATCH] Add some short docstrings for types. (#225) These types were missing a short docstring, leaving the comment space to their right blank on the crate page. Also, this takes advantage of intra-rustdoc links to link terms: https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md --- src/agent.rs | 1 + src/lib.rs | 4 ++-- src/resolve.rs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/agent.rs b/src/agent.rs index a2225db..a55c9ce 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -12,6 +12,7 @@ use { cookie_store::CookieStore, }; +/// Accumulates options towards building an [Agent]. #[derive(Debug)] pub struct AgentBuilder { config: AgentConfig, diff --git a/src/lib.rs b/src/lib.rs index 33dc1f7..9e5c60f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -231,7 +231,7 @@ pub use serde_json::{to_value as serde_to_value, Map as SerdeMap, Value as Serde use once_cell::sync::Lazy; use std::sync::atomic::{AtomicBool, Ordering}; -/// Creates an agent builder. +/// Creates an [AgentBuilder]. pub fn builder() -> AgentBuilder { AgentBuilder::new() } @@ -253,7 +253,7 @@ pub fn is_test(is: bool) -> bool { return x; } -/// Agents are used to keep state between requests. +/// Agents are used to hold configuration and keep state between requests. pub fn agent() -> Agent { #[cfg(not(test))] if is_test(false) { diff --git a/src/resolve.rs b/src/resolve.rs index fc32f99..a8c368a 100644 --- a/src/resolve.rs +++ b/src/resolve.rs @@ -3,6 +3,7 @@ use std::io::Result as IoResult; use std::net::{SocketAddr, ToSocketAddrs}; use std::sync::Arc; +/// A custom resolver to override the default DNS behavior. pub trait Resolver: Send + Sync { fn resolve(&self, netloc: &str) -> IoResult>; }