From bfa7767f04081729a34d2db82b61b7fd3147faaa Mon Sep 17 00:00:00 2001 From: sksat Date: Thu, 11 May 2023 01:55:40 +0900 Subject: [PATCH 1/3] add export-src, std feature to c2a-core crate --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 82fbf679c..cf530c180 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,7 @@ license-file = "LICENSE" repository = "https://github.com/ut-issl/c2a-core" documentation = "https://ut-issl.github.io/c2a-reference/c2a-core" + +[features] +std = [] +export-src = ["std"] From b5b07ec8e5c3818dff561378f020424dbfb5b40e Mon Sep 17 00:00:00 2001 From: sksat Date: Thu, 11 May 2023 01:57:26 +0900 Subject: [PATCH 2/3] c2a-core is no_std crate on std feature is not set --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 0c9ac1ac8..8731421b3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1 @@ -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] From 78637a0e01ccc4f3341c69e9a04018dec806a3e4 Mon Sep 17 00:00:00 2001 From: sksat Date: Thu, 11 May 2023 01:58:02 +0900 Subject: [PATCH 3/3] add source dir export func in export-src feature --- src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 8731421b3..93e0c161c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(feature = "export-src")] +pub fn source_dir() -> std::path::PathBuf { + std::path::Path::new(env!("CARGO_MANIFEST_DIR")).to_path_buf() +}