trex-re 0.1.0

Token-Regular EXpression: a regex-shaped pattern language over typed tokens, evaluated by derivatives with long-distance binding and no catastrophic backtracking.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! The standard output as a scan's reports write it, with the bytes written
//! counted, so `--stats` can say how many were printed.

use std::sync::atomic::{AtomicU64, Ordering};

static PRINTED: AtomicU64 = AtomicU64::new(0);

/// Print `s` and a newline.
pub fn line(s: &str) {
    println!("{s}");
    PRINTED.fetch_add(s.len() as u64 + 1, Ordering::Relaxed);
}

/// How many bytes the reports have printed so far.
pub fn printed() -> u64 {
    PRINTED.load(Ordering::Relaxed)
}