eqlog_runtime/lib.rs
1mod unification;
2
3#[doc(hidden)]
4pub use crate::unification::Unification;
5#[doc(hidden)]
6pub extern crate tabled;
7
8/// Declare an eqlog module.
9///
10/// # Examples
11/// The following simple version declares a module `foo` whose contents correspond `src/foo.eqlog`.
12/// ```ignore
13/// use eqlog_runtime::eqlog_mod;
14/// eqlog_mod!(foo);
15/// ```
16///
17/// This variant does not work for eqlog in proper subdirectories of `src`.
18/// For example, it will not work for `src/bar/baz.eqlog`.
19/// For such eqlog files, the following invocation of the `eqlog_mod` macro must be used:
20/// ```ignore
21/// eqlog_mod!(baz, "/bar/baz.rs")
22/// ```
23/// This declares a submodule `baz` in the current module whose contents correspond to
24/// `src/bar/baz.eqlog`.
25/// As before, the first argument is the rust module name.
26/// The second argument is the path of the eqlog file relative to the `src` directory, but with the
27/// `.rs` extension instead of .`eqlog`.
28/// The path must start with a slash.
29/// It is recommended that the rust module name agrees with the eqlog file name, and that the
30/// declaration above is in `src/bar/mod.rs` or in `src/bar.rs`.
31/// This results in the module path `bar::baz` relative the crate root.
32///
33/// Eqlog modules can be annotated with a visibility, or with attributes:
34/// ```ignore
35/// eqlog_mod!(#[cfg(test)] pub baz, "/bar/baz.rs")
36/// ```
37#[macro_export]
38macro_rules! eqlog_mod {
39 ($(#[$attr:meta])* $vis:vis $modname:ident) => {
40 eqlog_mod!($(#[$attr])* $vis $modname, concat!("/", stringify!($modname), ".rs"));
41 };
42
43 ($(#[$attr:meta])* $vis:vis $modname:ident, $source:expr) => {
44 $(#[$attr])* $vis mod $modname { include!(concat!(env!("EQLOG_OUT_DIR"), $source)); }
45 };
46}