docx_reader/documents/toc_key.rs
use std::sync::atomic::AtomicUsize;
static TOC_KEY: AtomicUsize = AtomicUsize::new(0);
pub trait TocKeyGenerator {
fn generate() -> String {
use std::sync::atomic::Ordering;
let id = TOC_KEY.load(Ordering::Relaxed);
TOC_KEY.store(id + 1, Ordering::Relaxed);
format!("_Toc{:08}", id)
}
}
pub struct TocKey {}
impl TocKeyGenerator for TocKey {}