Skip to content

Commit

Permalink
Remove lazy-static in favor of once_cell
Browse files Browse the repository at this point in the history
  • Loading branch information
Gifted-s committed Jul 13, 2024
1 parent c8659a3 commit 9012e04
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion constants/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [
edition = "2021"

[dependencies]
lazy_static = "1.4.0"
cargo_toml = "0.15.2"
anyhow = "*"
serde_json = "1.0.64"
once_cell = "1.19.0"
25 changes: 15 additions & 10 deletions constants/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
use lazy_static::lazy_static;
use once_cell::sync::Lazy;

pub const VENDOR_IDENTIFIER: &str = "MongoDB";
pub const DRIVER_NAME: &str = "MongoDB Atlas SQL ODBC Driver";
pub const DBMS_NAME: &str = "MongoDB Atlas";
pub const ODBC_VERSION: &str = "03.80";
pub const DRIVER_SHORT_NAME: &str = "mongodb-odbc";

lazy_static! {
pub static ref DRIVER_METRICS_VERSION: String = format!(
pub static DRIVER_METRICS_VERSION: Lazy<String> = Lazy::new(|| {
format!(
"{}.{}.{}",
env!("CARGO_PKG_VERSION_MAJOR"),
env!("CARGO_PKG_VERSION_MINOR"),
env!("CARGO_PKG_VERSION_PATCH")
);
pub static ref DRIVER_LOG_VERSION: String = format!(
)
});

pub static DRIVER_LOG_VERSION: Lazy<String> = Lazy::new(|| {
format!(
"{}.{}",
env!("CARGO_PKG_VERSION_MAJOR"),
env!("CARGO_PKG_VERSION_MINOR")
);
pub static ref DEFAULT_APP_NAME: String =
format!("{}+{}", DRIVER_SHORT_NAME, DRIVER_METRICS_VERSION.as_str());
pub static ref DRIVER_ODBC_VERSION: String = format_driver_version();
}
)
});

pub static DEFAULT_APP_NAME: Lazy<String> =
Lazy::new(|| format!("{}+{}", DRIVER_SHORT_NAME, DRIVER_METRICS_VERSION.as_str()));

pub static DRIVER_ODBC_VERSION: Lazy<String> = Lazy::new(|| format_driver_version());

// The default max string length if a user enables max string length.
// Typically, the Atlas SQL ODBC driver does not specify a max string
Expand Down

0 comments on commit 9012e04

Please sign in to comment.