Compare commits

...

1 Commits

Author SHA1 Message Date
Ginger 317eabc4eb feat: Add arbit utility module 2026-02-10 09:56:28 -05:00
5 changed files with 26 additions and 0 deletions
Generated
+7
View File
@@ -1123,6 +1123,7 @@ dependencies = [
"ctor",
"cyborgtime",
"either",
"fastrand",
"figment",
"futures",
"hardened_malloc-rs",
@@ -1921,6 +1922,12 @@ dependencies = [
"zune-inflate",
]
[[package]]
name = "fastrand"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "fax"
version = "0.2.6"
+4
View File
@@ -70,6 +70,10 @@ version = "0.1.3"
[workspace.dependencies.rand]
version = "0.8.5"
# used for stamps
[workspace.dependencies.fastrand]
version = "2.3.0"
# Used for the http request / response body type for Ruma endpoints used with reqwest
[workspace.dependencies.bytes]
version = "1.10.1"
+1
View File
@@ -71,6 +71,7 @@ core_affinity.workspace = true
ctor.workspace = true
cyborgtime.workspace = true
either.workspace = true
fastrand.workspace = true
figment.workspace = true
futures.workspace = true
http-body-util.workspace = true
+13
View File
@@ -0,0 +1,13 @@
pub const ARBIT_LENGTH: usize = 32;
/// An arbit is an opaque, random 32-byte identifier.
/// They are useful as unique, unordered database keys with no particular
/// semantics except uniqueness.
pub type Arbit = [u8; ARBIT_LENGTH];
#[must_use]
#[inline]
pub fn arbit() -> Arbit {
let mut arbit = [0; ARBIT_LENGTH];
fastrand::fill(&mut arbit);
arbit
}
+1
View File
@@ -1,3 +1,4 @@
pub mod arbit;
pub mod arrayvec;
pub mod bool;
pub mod bytes;