doc: update doctest to use CookieStore::new()
in example
This commit is contained in:
parent
8cc7a2c145
commit
3eb095d08f
1 changed files with 9 additions and 4 deletions
13
src/lib.rs
13
src/lib.rs
|
@ -9,11 +9,16 @@
|
|||
//! # tokio_test::block_on(async {
|
||||
//! // Load an existing set of cookies, serialized as json
|
||||
//! let cookie_store = {
|
||||
//! let file = std::fs::File::open("cookies.json")
|
||||
//! if let Ok(file) = std::fs::File::open("cookies.json")
|
||||
//! .map(std::io::BufReader::new)
|
||||
//! .unwrap();
|
||||
//! // use re-exported version of `CookieStore` for crate compatibility
|
||||
//! reqwest_cookie_store::CookieStore::load_json(file).unwrap()
|
||||
//! {
|
||||
//! // use re-exported version of `CookieStore` for crate compatibility
|
||||
//! reqwest_cookie_store::CookieStore::load_json(file).unwrap()
|
||||
//! }
|
||||
//! else
|
||||
//! {
|
||||
//! reqwest_cookie_store::CookieStore::new(None)
|
||||
//! }
|
||||
//! };
|
||||
//! let cookie_store = reqwest_cookie_store::CookieStoreMutex::new(cookie_store);
|
||||
//! let cookie_store = std::sync::Arc::new(cookie_store);
|
||||
|
|
Loading…
Reference in a new issue