From 145d855b96fe2b6a6a1bc94fb3fc8d45edb2923c Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Tue, 9 Apr 2024 17:39:50 +0300 Subject: [PATCH] wrap the options in an arc --- src/http.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/http.rs b/src/http.rs index 7c07e6e..7e9a14b 100644 --- a/src/http.rs +++ b/src/http.rs @@ -10,28 +10,28 @@ use reqwest::{ header::{HeaderMap, HeaderValue}, Method, StatusCode, Url, }; -use std::pin::Pin; use std::str::FromStr; +use std::{pin::Pin, sync::Arc}; /// A struct that implements [AsyncSliceReader] using HTTP range requests #[derive(Debug)] pub struct HttpAdapter { - opts: http_adapter::Opts, + opts: Arc, size: Option, } impl HttpAdapter { /// Creates a new [`HttpAdapter`] from a URL pub fn new(url: Url) -> Self { - Self::with_opts(Opts { + Self::with_opts(Arc::new(Opts { url, client: reqwest::Client::new(), headers: None, - }) + })) } /// Creates a new [`HttpAdapter`] from a URL and options - pub fn with_opts(opts: http_adapter::Opts) -> Self { + pub fn with_opts(opts: Arc) -> Self { Self { opts, size: None } }