Rust 1.80

Preserves the fn accessors within the Monero crates so that we can use statics
in some cfgs yet not all (in order to provide support for more low-memory
devices) with the exception of `H` (which truly should be cached).
This commit is contained in:
Luke Parker
2024-07-26 19:20:04 -04:00
parent 6f34c2ff77
commit 880565cb81
38 changed files with 147 additions and 195 deletions

View File

@@ -40,17 +40,14 @@ fn generators(prefix: &'static str, path: &str) {
.write_all(
format!(
"
static GENERATORS_CELL: OnceLock<Generators> = OnceLock::new();
pub(crate) fn GENERATORS() -> &'static Generators {{
GENERATORS_CELL.get_or_init(|| Generators {{
G: std_shims::vec![
{G_str}
],
H: std_shims::vec![
{H_str}
],
}})
}}
pub(crate) static GENERATORS: LazyLock<Generators> = LazyLock::new(|| Generators {{
G: std_shims::vec![
{G_str}
],
H: std_shims::vec![
{H_str}
],
}});
",
)
.as_bytes(),
@@ -67,12 +64,9 @@ fn generators(prefix: &'static str, path: &str) {
.write_all(
format!(
r#"
static GENERATORS_CELL: OnceLock<Generators> = OnceLock::new();
pub(crate) fn GENERATORS() -> &'static Generators {{
GENERATORS_CELL.get_or_init(|| {{
monero_generators::bulletproofs_generators(b"{prefix}")
}})
}}
pub(crate) static GENERATORS: LazyLock<Generators> = LazyLock::new(|| {{
monero_generators::bulletproofs_generators(b"{prefix}")
}});
"#,
)
.as_bytes(),