swactor/src/lib.rs
zacheryasc 08a655d88a refactor: graph-optimization (#17)
Use spectral analysis tool to find spurious edges in the code DAG, refactoring to prune.
2026-02-07 16:51:40 +00:00

41 lines
877 B
Rust

pub mod actor;
pub mod worker;
pub(crate) mod channel;
pub(crate) mod error;
pub use error::Error;
pub mod config;
pub(crate) mod delivery;
pub mod stats;
pub mod runtime;
#[cfg(feature = "python")]
mod python;
#[cfg(feature = "python")]
#[pyo3::pymodule]
fn swactor(m: &pyo3::Bound<'_, pyo3::types::PyModule>) -> pyo3::PyResult<()> {
python::register(m)
}
#[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>()];
}
}