remainder/
utils.rs

1//! Module for useful functions
2/// Helpful arithmetic functions.
3pub mod arithmetic;
4/// Helpful functions for debugging.
5pub mod debug;
6/// Helpful functions for manipulating MLEs (e.g. padding).
7pub mod mle;
8
9#[cfg(test)]
10/// Utilities that are only useful for tests
11pub(crate) mod test_utils;
12
13use std::fs;
14
15/// Returns whether a particular file exists in the filesystem
16pub fn file_exists(file_path: &String) -> bool {
17    match fs::metadata(file_path) {
18        Ok(file_metadata) => file_metadata.is_file(),
19        Err(_) => false,
20    }
21}
22
23/// Returns `true` if the parallel feature is on for the `remainder`
24/// crate.
25pub fn is_parallel_feature_on() -> bool {
26    #[cfg(feature = "parallel")]
27    return true;
28
29    #[cfg(not(feature = "parallel"))]
30    return false;
31}