1#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
6#![doc = include_str!("../README.md")]
8
9pub mod memory;
10pub mod protocol;
11pub mod transport;
12
13use std::fmt;
14use std::sync::atomic::{AtomicU64, Ordering};
15
16#[derive(Clone, Copy, Debug, Default)]
20pub(crate) struct LogId(u64);
21
22impl From<u64> for LogId {
23 fn from(id: u64) -> Self {
24 Self(id)
25 }
26}
27
28impl fmt::Display for LogId {
29 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30 self.0.fmt(f)
31 }
32}
33
34static SESSIONS: AtomicU64 = AtomicU64::new(0);
37
38pub(crate) fn next_log_id() -> LogId {
40 LogId(SESSIONS.fetch_add(1, Ordering::Relaxed) + 1)
41}
42
43#[cfg(test)]
44#[cfg_attr(coverage_nightly, coverage(off))]
45mod testing;