Skip to content
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

Migrate Lazy Initialization from Once_Cell to Std #233

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion Cargo.lock

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

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

[dependencies]
lazy_static = "1.4.0"
cargo_toml = "0.15.2"
anyhow = "*"
serde_json = "1.0.64"
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 std::sync::LazyLock;

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: LazyLock<String> = LazyLock::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: LazyLock<String> = LazyLock::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: LazyLock<String> =
LazyLock::new(|| format!("{}+{}", DRIVER_SHORT_NAME, DRIVER_METRICS_VERSION.as_str()));

pub static DRIVER_ODBC_VERSION: LazyLock<String> = LazyLock::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