Skip to main content

muse2/
lib.rs

1//! Common functionality for MUSE2.
2#![warn(missing_docs)]
3
4/// The main GitHub issues page for MUSE2
5pub const ISSUES_URL: &str = concat!(env!("CARGO_PKG_REPOSITORY"), "/issues");
6
7/// A macro to get a url to the most recent version of the documentation
8#[macro_export]
9macro_rules! docs_url {
10    () => {
11        docs_url!("")
12    };
13    ($suffix:literal) => {
14        docs_url!(concat!("v", env!("CARGO_PKG_VERSION")), $suffix)
15    };
16    ($version:expr, $suffix:literal) => {
17        concat!(env!("CARGO_PKG_HOMEPAGE"), "/", $version, "/", $suffix)
18    };
19}
20
21use dirs::config_dir;
22use std::path::PathBuf;
23
24pub mod agent;
25pub mod asset;
26pub mod cli;
27pub mod commodity;
28pub mod example;
29pub mod finance;
30pub mod graph;
31pub mod id;
32pub mod input;
33pub mod log;
34pub mod model;
35pub mod output;
36pub mod patch;
37pub mod process;
38pub mod region;
39pub mod settings;
40pub mod simulation;
41pub mod time_slice;
42pub mod timeit;
43pub mod units;
44
45#[cfg(test)]
46mod fixture;
47
48/// Get config dir for program.
49///
50/// In the unlikely event this path cannot be retrieved, the CWD will be returned.
51pub fn get_muse2_config_dir() -> PathBuf {
52    let Some(mut config_dir) = config_dir() else {
53        return PathBuf::default();
54    };
55
56    config_dir.push("muse2");
57    config_dir
58}