commit 507471070811013217b2c687c7da6ffedb713481
parent c74f7019502a276f2af651ca4a8d67582552db6e
Author: MTRNord <mtrnord1@gmail.com>
Date: Sat, 6 Feb 2021 16:12:27 +0100
feat: Allow using the utils without macros
Diffstat:
4 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/mrsbfh/Cargo.toml b/mrsbfh/Cargo.toml
@@ -15,7 +15,7 @@ url = "2.1.1"
thiserror = "1.0"
# Command macros
-mrsbfh-macros = {path = "../mrsbfh-macros"}
+mrsbfh-macros = {path = "../mrsbfh-macros", optional = true}
const-concat = {git = "https://github.com/Vurich/const-concat", rev = "f836e77a4ecadf6a11994340fdcbbdadcdc4906d"}
tokio = { version = "0.2", features = ["full"] }
@@ -28,3 +28,7 @@ serde_json = "1"
pulldown-cmark = "0.8.0" # For generating the help text
regex = "1.4.3"
+
+[features]
+default = ["macros"]
+macros = ["mrsbfh-macros"]
diff --git a/mrsbfh/src/commands.rs b/mrsbfh/src/commands.rs
@@ -119,4 +119,5 @@
//! in the example.
//!
+#[cfg(feature = "macros")]
pub use mrsbfh_macros::{command, command_generate, commands};
diff --git a/mrsbfh/src/config.rs b/mrsbfh/src/config.rs
@@ -35,6 +35,8 @@ use serde::Serialize;
use std::path::Path;
use crate::errors::ConfigError;
+
+#[cfg(feature = "macros")]
pub use mrsbfh_macros::ConfigDerive;
pub trait Loader {
diff --git a/mrsbfh/src/utils.rs b/mrsbfh/src/utils.rs
@@ -99,12 +99,12 @@
//! in the example.
//!
+use crate::errors::SessionError;
use serde::{Deserialize, Serialize};
-use std::error::Error;
use std::path::PathBuf;
use tracing::*;
-use crate::errors::SessionError;
+#[cfg(feature = "macros")]
pub use mrsbfh_macros::autojoin;
#[derive(Clone, Debug, Serialize, Deserialize)]