change to using once_cell for lazy init

This commit is contained in:
Henry Schimke
2023-01-05 10:53:55 -06:00
parent d2a4b21808
commit 20764559ae
37 changed files with 556 additions and 608 deletions

View File

@@ -21,14 +21,12 @@ use crate::{
use super::{one_d_reader, EANManufacturerOrgSupport, OneDReader, UPCEANExtensionSupport};
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
lazy_static! {
pub static ref EAN_MANUFACTURER_SUPPORT: EANManufacturerOrgSupport =
EANManufacturerOrgSupport::default();
pub static ref UPC_EAN_EXTENSION_SUPPORT: UPCEANExtensionSupport =
UPCEANExtensionSupport::default();
}
pub static EAN_MANUFACTURER_SUPPORT: Lazy<EANManufacturerOrgSupport> =
Lazy::new(|| EANManufacturerOrgSupport::default());
pub static UPC_EAN_EXTENSION_SUPPORT: Lazy<UPCEANExtensionSupport> =
Lazy::new(|| UPCEANExtensionSupport::default());
// These two values are critical for determining how permissive the decoding will be.
// We've arrived at these values through a lot of trial and error. Setting them any higher