Remove everything `proc_macro` from what will go public
I thought the "proc macros need to live in a separate crate" problem was only a minor annoyance until now: publishing a crate that uses it implies publishing the proc macro crate too. This patch works around said annoyance by (mostly manually) reverting the move to the `tique` module. Now `cantine_derive` is self-contained.
- Id
- c7c1a5ff6413dda495ab3830726433680778e4ff
- Author
- Caio
- Commit time
- 2020-01-29T13:43:43+01:00
Modified Cargo.toml
[workspace]
members = [
"cantine",
+ "cantine_derive",
"tique",
- "tique_derive",
]
Modified cantine/Cargo.toml
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+cantine_derive = { path = "../cantine_derive" }
tique = { path = "../tique", features = ["unstable"] }
actix-rt = "1.0"
actix-service = "1.0"
Modified tique/Cargo.toml
[features]
default = []
-unstable = ["tique_derive", "serde", "byteorder", "nom"]
+unstable = ["nom"]
[dependencies]
tantivy = "0.11"
-tique_derive = { path = "../tique_derive", optional = true }
-serde = { version = "1", features = ["derive"], optional = true }
-byteorder = { version = "1.3", optional = true }
nom = { version = "5", optional = true }
[dev-dependencies]
Modified cantine/src/model.rs
use uuid::{self, Uuid};
use crate::database::DatabaseRecord;
-use tique::FilterAndAggregation;
+use cantine_derive::FilterAndAggregation;
#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)]
pub struct Recipe {
Modified tique/src/lib.rs
#[cfg(feature = "unstable")]
pub mod queryparser;
-
-#[cfg(feature = "unstable")]
-mod derive;
-
-#[cfg(feature = "unstable")]
-pub use derive::RangeStats;
-
-#[cfg(feature = "unstable")]
-pub use tique_derive::FilterAndAggregation;
Renamed tique/src/derive.rs to cantine_derive/src/lib.rs
use serde::Serialize;
use std::ops::Range;
+pub use cantine_derive_internal::FilterAndAggregation;
+
#[derive(Serialize, Debug, Clone)]
pub struct RangeStats<T> {
pub min: T,
Renamed tique_derive/src/lib.rs to cantine_derive/internal/src/lib.rs
quote_spanned! { field.span()=>
#[serde(skip_serializing_if = "Vec::is_empty")]
- pub #name: Vec<tique::RangeStats<#ty>>
+ pub #name: Vec<cantine_derive::RangeStats<#ty>>
}
});
Renamed tique_derive/tests/basic.rs to cantine_derive/tests/basic.rs
Document, Index, SegmentReader,
};
-use tique::{FilterAndAggregation, RangeStats};
+use cantine_derive::{FilterAndAggregation, RangeStats};
#[derive(FilterAndAggregation, Default)]
pub struct Feat {
Renamed tique_derive/Cargo.toml to cantine_derive/Cargo.toml
[package]
-name = "tique_derive"
+name = "cantine_derive"
version = "0.1.0"
authors = ["Caio Romão <contact@caio.co>"]
edition = "2018"
-[lib]
-proc-macro = true
-
[dependencies]
-proc-macro2 = "1.0"
-syn = "1.0"
-quote = "1.0"
+cantine_derive_internal = { path = "./internal" }
+serde = { version = "1.0" }
+tantivy = "0.11"
[dev-dependencies]
-tique = { path = "../tique" }
serde = { version = "1.0", features = ["derive"] }
-tantivy = "0.11"
Created cantine_derive/internal/Cargo.toml
+[package]
+name = "cantine_derive_internal"
+version = "0.1.0"
+authors = ["Caio Romão <contact@caio.co>"]
+edition = "2018"
+
+[lib]
+proc-macro = true
+
+[dependencies]
+proc-macro2 = "1.0"
+syn = "1.0"
+quote = "1.0"