Exposed RedirectAction and RedirectAttempt
- also added minimal doc to RedirectAttempt to satisfy #![deny(missing_docs)] - added links to `RedirectPolicy::Custom` docs
This commit is contained in:
		| @@ -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; | ||||
|  | ||||
|   | ||||
| @@ -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<T>(policy: T) -> RedirectPolicy | ||||
|     where | ||||
|         T: Fn(RedirectAttempt) -> RedirectAction + Send + Sync + 'static, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user