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
90 changes: 57 additions & 33 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fs-err = "2.9.0"
fs2 = "0.4.3"
futures = "0.3"
futures-channel = "0.3"
getrandom = "0.2.7"
getrandom02 = { package = "getrandom", version = "0.2" }
glob = "0.3.1"
hashbrown = { version = "0.15", default-features = false, features = ["equivalent", "inline-more"] }
headers = "0.4"
Expand Down Expand Up @@ -206,7 +206,8 @@ proptest = "1.4"
proptest-derive = "0.5"
quick-junit = { version = "0.3.2" }
quote = "1.0.8"
rand = "0.8.5"
rand08 = { package = "rand", version = "0.8" }
rand = "0.9"
rayon = "1.8"
rayon-core = "1.11.0"
regex = "1"
Expand Down
3 changes: 1 addition & 2 deletions crates/bench/benches/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use criterion::{
};
use foldhash::{HashSet, HashSetExt};
use itertools::Itertools as _;
use rand::{distributions::Standard, rngs::ThreadRng, Rng};
use spacetimedb_data_structures::map::{Entry, HashMap};
use spacetimedb_table::indexes::{PageIndex, PageOffset, RowPointer, Size, SquashedOffset};
use spacetimedb_table::table_index::unique_direct_index::UniqueDirectIndex;
Expand Down Expand Up @@ -56,7 +55,7 @@ fn monotonic_keys(n: u64) -> impl Clone + Iterator<Item = K> {
fn random_keys(n: u64) -> HashSet<K> {
let desired_len = n as usize;
let mut set = HashSet::with_capacity(desired_len);
let mut iter = ThreadRng::default().sample_iter(Standard);
let mut iter = rand::random_iter();
while set.len() < desired_len {
set.insert(iter.next().unwrap());
}
Expand Down
7 changes: 4 additions & 3 deletions crates/bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ bench = false

[features]
default = ["rand"]
rand = ["dep:rand", "dep:getrandom"]
rand = ["rand08"]
rand08 = ["dep:rand08", "dep:getrandom02"]
unstable = ["spacetimedb-bindings-sys/unstable"]

[dependencies]
Expand All @@ -29,11 +30,11 @@ derive_more.workspace = true
log.workspace = true
scoped-tls.workspace = true

rand = { workspace = true, optional = true }
rand08 = { workspace = true, optional = true }
# we depend on getrandom and enable the `custom` feature, so that
# if someone tries to use rand's ThreadRng, it will fail to link
# because no one defined __getrandom_custom
getrandom = { workspace = true, optional = true, features = ["custom"] }
getrandom02 = { workspace = true, optional = true, features = ["custom"] }

[dev-dependencies]
insta.workspace = true
Expand Down
8 changes: 4 additions & 4 deletions crates/bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mod client_visibility_filter;
pub mod log_stopwatch;
mod logger;
#[cfg(feature = "rand")]
#[cfg(feature = "rand08")]
mod rng;
#[doc(hidden)]
pub mod rt;
Expand All @@ -17,11 +17,11 @@ use std::cell::RefCell;

pub use log;
#[cfg(feature = "rand")]
pub use rand;
pub use rand08 as rand;

#[cfg(feature = "unstable")]
pub use client_visibility_filter::Filter;
#[cfg(feature = "rand")]
#[cfg(feature = "rand08")]
pub use rng::StdbRng;
pub use sats::SpacetimeType;
#[doc(hidden)]
Expand Down Expand Up @@ -730,7 +730,7 @@ pub struct ReducerContext {
/// See the [`#[table]`](macro@crate::table) macro for more information.
pub db: Local,

#[cfg(feature = "rand")]
#[cfg(feature = "rand08")]
rng: std::cell::OnceCell<StdbRng>,
}

Expand Down
Loading
Loading