elfo_core/node.rs
1use std::sync::atomic::{AtomicU16, Ordering};
2
3static NODE_NO: AtomicU16 = AtomicU16::new(65535);
4
5pub type NodeNo = u16;
6
7/// Returns the current `node_no`.
8pub fn node_no() -> NodeNo {
9 NODE_NO.load(Ordering::Relaxed)
10}
11
12/// Sets the current `node_no`.
13/// The value `65535` is used if isn't called.
14///
15/// `node_no` should be set during setup stage, now reexport via `_priv`.
16pub(crate) fn set_node_no(node_no: NodeNo) {
17 NODE_NO.store(node_no, Ordering::Relaxed)
18}