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        concat!(
15            env!("CARGO_PKG_HOMEPAGE"),
16            "/v",
17            env!("CARGO_PKG_VERSION"),
18            "/",
19            $suffix
20        )
21    };
22}
23
24use dirs::config_dir;
25use std::path::PathBuf;
26
27pub mod agent;
28pub mod asset;
29pub mod cli;
30pub mod commodity;
31pub mod example;
32pub mod finance;
33pub mod graph;
34pub mod id;
35pub mod input;
36pub mod log;
37pub mod model;
38pub mod output;
39pub mod patch;
40pub mod process;
41pub mod region;
42pub mod settings;
43pub mod simulation;
44pub mod time_slice;
45pub mod timeit;
46pub mod units;
47
48#[cfg(test)]
49mod fixture;
50
51/// Get config dir for program.
52///
53/// In the unlikely event this path cannot be retrieved, the CWD will be returned.
54pub fn get_muse2_config_dir() -> PathBuf {
55    let Some(mut config_dir) = config_dir() else {
56        return PathBuf::default();
57    };
58
59    config_dir.push("muse2");
60    config_dir
61}