Skip to content
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
89 changes: 21 additions & 68 deletions Cargo.lock

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

7 changes: 1 addition & 6 deletions crates/terraphim_automata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ pub async fn load_thesaurus_from_json_and_replace_async(
/// Note: Remote loading requires the "remote-loading" feature to be enabled.
#[cfg(feature = "remote-loading")]
pub async fn load_thesaurus(automata_path: &AutomataPath) -> Result<Thesaurus> {
#[allow(dead_code)]
async fn read_url(url: String) -> Result<String> {
log::debug!("Reading thesaurus from remote: {url}");
let response = reqwest::Client::builder()
Expand Down Expand Up @@ -388,11 +387,7 @@ pub async fn load_thesaurus(automata_path: &AutomataPath) -> Result<Thesaurus> {
}
fs::read_to_string(path)?
}
AutomataPath::Remote(_) => {
return Err(TerraphimAutomataError::InvalidThesaurus(
"Remote loading is not supported. Enable the 'remote-loading' feature.".to_string(),
));
}
AutomataPath::Remote(url) => read_url(url.clone()).await?,
};

let thesaurus = serde_json::from_str(&contents)?;
Expand Down
1 change: 0 additions & 1 deletion crates/terraphim_rolegraph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ aho-corasick = "1.0.2"
anyhow = { version = "1.0", optional = true }
itertools = "0.14.0"
log = "0.4.29"
memoize = "0.5.1"
regex = "1.12.3"
serde = { version = "1.0.192", features = ["derive"] }
serde_json = "1.0.64"
Expand Down
6 changes: 2 additions & 4 deletions crates/terraphim_rolegraph/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use ahash::AHashMap;
use itertools::Itertools;
use memoize::memoize;
use regex::Regex;
use std::collections::hash_map::Entry;
use std::sync::Arc;
Expand Down Expand Up @@ -1264,8 +1263,7 @@ pub fn split_paragraphs(paragraphs: &str) -> Vec<&str> {

/// Combining two numbers into a unique one: pairing functions.
/// It uses "elegant pairing" (https://odino.org/combining-two-numbers-into-a-unique-one-pairing-functions/).
/// also using memoize macro with Ahash hasher
#[memoize(CustomHasher: ahash::AHashMap)]
#[inline]
pub fn magic_pair(x: u64, y: u64) -> u64 {
if x >= y { x * x + x + y } else { y * y + x }
}
Expand All @@ -1279,7 +1277,7 @@ pub fn magic_pair(x: u64, y: u64) -> u64 {
// }
/// return q, l - q
/// }
#[memoize(CustomHasher: ahash::AHashMap)]
#[inline]
pub fn magic_unpair(z: u64) -> (u64, u64) {
let q = (z as f64).sqrt().floor() as u64;
let l = z - q * q;
Expand Down
Loading
Loading