Skip to content

refactor: Change to once_cell #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ aws-config = "0.6.0"
blocking = "1.1.0"
anyhow = "1"
reqwest = "0.11"
lazy_static = "1"
once_cell = "1"

[dev-dependencies]
uuid = { version = "0.8", features = ["serde", "v4"] }
Expand Down
22 changes: 10 additions & 12 deletions src/services/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use aws_smithy_http::byte_stream::ByteStream;
use aws_smithy_http::result::SdkError;
use futures::TryStreamExt;
use http::{HeaderValue, StatusCode};
use lazy_static::lazy_static;
use once_cell::sync::Lazy;

use crate::credential::Credential;
use crate::error::Error;
Expand All @@ -48,17 +48,15 @@ use crate::readers::ReaderStream;
use crate::Accessor;
use crate::BoxedAsyncReader;

lazy_static! {
static ref ENDPOINT_TEMPLATES: HashMap<&'static str, &'static str> = {
let mut m = HashMap::new();
// AWS S3 Service.
m.insert(
"https://s3.amazonaws.com",
"https://s3.{region}.amazonaws.com",
);
m
};
}
static ENDPOINT_TEMPLATES: Lazy<HashMap<&'static str, &'static str>> = Lazy::new(|| {
let mut m = HashMap::new();
// AWS S3 Service.
m.insert(
"https://s3.amazonaws.com",
"https://s3.{region}.amazonaws.com",
);
m
});

/// # TODO
///
Expand Down