Page MenuHomePhorge

helpers.rs
No OneTemporary

Size
571 B
Referenced Files
None
Subscribers
None

helpers.rs

use anyhow::Error;
use macros_rs::str;
use std::path::Path;
use std::sync::atomic::{AtomicUsize, Ordering};
pub struct Id {
pub counter: AtomicUsize,
}
impl Id {
pub fn new(start: usize) -> Self { Id { counter: AtomicUsize::new(start) } }
pub fn next(&self) -> usize { self.counter.fetch_add(1, Ordering::SeqCst) }
}
pub struct Exists;
impl Exists {
pub fn folder(dir_name: String) -> Result<bool, Error> { Ok(Path::new(str!(dir_name)).is_dir()) }
pub fn file(file_name: String) -> Result<bool, Error> { Ok(Path::new(str!(file_name)).exists()) }
}

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 15, 6:27 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
484871
Default Alt Text
helpers.rs (571 B)

Event Timeline