Skip to content

Commit

Permalink
wrap the options in an arc
Browse files Browse the repository at this point in the history
  • Loading branch information
rklaehn committed Apr 9, 2024
1 parent 224c963 commit 145d855
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<http_adapter::Opts>,
size: Option<u64>,
}

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<http_adapter::Opts>) -> Self {
Self { opts, size: None }
}

Expand Down

0 comments on commit 145d855

Please sign in to comment.