From 40887488cf8dd1e1b5dbcb7cd699f6dec8f87a81 Mon Sep 17 00:00:00 2001 From: Michal Budzynski Date: Sun, 4 Jun 2017 03:20:09 +0200 Subject: [PATCH] Exposed RedirectAction and RedirectAttempt - also added minimal doc to RedirectAttempt to satisfy #![deny(missing_docs)] - added links to `RedirectPolicy::Custom` docs --- src/lib.rs | 2 +- src/redirect.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d3ddb08..0be60a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -163,7 +163,7 @@ pub use url::ParseError as UrlError; pub use self::client::{Certificate, Client, ClientBuilder}; pub use self::error::{Error, Result}; pub use self::body::Body; -pub use self::redirect::RedirectPolicy; +pub use self::redirect::{RedirectAction, RedirectAttempt, RedirectPolicy}; pub use self::request::{Request, RequestBuilder}; pub use self::response::Response; diff --git a/src/redirect.rs b/src/redirect.rs index 0d4a379..2922802 100644 --- a/src/redirect.rs +++ b/src/redirect.rs @@ -13,6 +13,8 @@ pub struct RedirectPolicy { inner: Policy, } +/// A type that holds information on the next request and previous requests +/// in redirect chain. #[derive(Debug)] pub struct RedirectAttempt<'a> { next: &'a Url, @@ -51,10 +53,10 @@ impl RedirectPolicy { /// The custom policy should have some way of handling those. /// /// Information on the next request and previous requests can be found - /// on the `RedirectAttempt` argument passed to the closure. + /// on the [`RedirectAttempt`] argument passed to the closure. /// /// Actions can be conveniently created from methods on the - /// `RedirectAttempt`. + /// [`RedirectAttempt`]. /// /// # Example /// @@ -78,6 +80,8 @@ impl RedirectPolicy { /// # Ok(()) /// # } /// ``` + /// + /// [`RedirectAttempt`]: struct.RedirectAttempt.html pub fn custom(policy: T) -> RedirectPolicy where T: Fn(RedirectAttempt) -> RedirectAction + Send + Sync + 'static,