swactor/src/lib.rs
zacheryasc 5a9af73de6 refactor: major library changes (#5)
Refactoring to logically separate component modules in order to make it easier to develop tests, metrics, tracing, etc.
2026-02-06 11:25:37 +00:00

31 lines
674 B
Rust

pub mod actor;
pub mod worker;
pub(crate) mod channel;
pub(crate) mod error;
pub use error::Error;
pub(crate) mod address_map;
pub mod config;
pub mod runtime;
#[cfg(feature = "getrandom")]
pub(crate) fn get_random(buf: &mut [u8]) {
getrandom::getrandom(buf).unwrap()
}
#[cfg(feature = "no_random")]
pub(crate) fn get_random(buf: &mut [u8]) {
use core::sync::atomic::{AtomicUsize, Ordering};
static COUNTER: AtomicUsize = AtomicUsize::new(0);
let value = COUNTER.fetch_add(1, Ordering::Relaxed);
let bytes = value.to_ne_bytes();
for (i, byte) in buf.iter_mut().enumerate() {
*byte = bytes[i % core::mem::size_of::<usize>()];
}
}