Skip to main content

derive_deftly/
lib.rs

1// This is the "library" crate.
2//
3// It is conventional for proc macro crates to be wrapped up
4// in a library crate, which reexport the proc macros, mostly because
5// a proc macro crate cannot contain anything else.
6//
7// Currently our plans do not appear to include any items other than
8// proc macros.  But we shouldn't foreclose that.  So for now
9// this library crate ought to declare a dependency on the macro crate
10// and reexport the macros.
11//
12// Also this crate is where the docs live, right here as crate-level
13// docs.
14
15#![allow(clippy::style, clippy::complexity)]
16#![deny(clippy::disallowed_methods)]
17#![allow(rustdoc::invalid_html_tags)] // @derive-deftly invalid-html-tags
18#![doc=include_str!("../README.md")]
19//
20// We take some serious liberties with rustdoc's HTML, here.
21// We want this "overall TOC" to be an h1 heading
22// and we want it *not* to be within the div
23// that rustdoc puts this this whole toplevel docs in.
24// So we *close that div* and reopen a new one.
25//!
26//! </div><!-- @derive-deftly invalid-html-tags -->
27//!
28//! <h1 class="section-header main-heading" id="overall-toc"><a class="doc-anchor" href="#overall-toc">ยง</a><strong>derive-deftly documentation, overall table of contents</strong></h1>
29//!
30//! <div class="docblock">
31//!
32//! <!-- @dd-navbar overall-toc . -->
33//! <!-- this line automatically maintained by update-navbars --><nav style="text-align: right; margin-bottom: 12px;">[ <em>docs: <a href="index.html">crate top-level</a> | <strong>overall toc, macros</strong> | <a href="doc_reference/index.html">template etc. reference</a> | <a href="https://diziet.pages.torproject.net/rust-derive-deftly/latest/guide/">guide/tutorial</a></em> ]</nav>
34//!
35//! </div>
36//! <div><!-- @derive-deftly invalid-html-tags -->
37//! <p style="margin-top: 25px"></p>
38//!
39// This next part is is also unwarranted chumminess with rustdoc.
40// Some time between Rust 1.85 and 1.86, rustdoc changed from using
41// <ul> and a pair of <div> with <class>, to this <dd>, which is better.
42// This does mean this doesn't render precisely right on older compilers.
43//
44//! <dl class="item-table">
45//! <dt><a href="https://diziet.pages.torproject.net/rust-derive-deftly/latest/guide/">Guide</a></dt>
46//! <dd>Tutorial and walkthrough, in book form</dd>
47//! </dl>
48
49pub use derive_deftly_macros::derive_deftly_engine;
50pub use derive_deftly_macros::{
51    define_derive_deftly, define_derive_deftly_module, derive_deftly_adhoc,
52    template_export_semver_check, Deftly,
53};
54
55// We (ab)use the module system as places to hang our documentation.
56
57#[deny(rustdoc::invalid_html_tags)]
58#[doc=include_str!("../doc/reference.md")]
59pub mod doc_reference {}
60
61#[deny(rustdoc::invalid_html_tags)]
62#[doc=include_str!("../doc/implementation.md")]
63pub mod doc_implementation {}
64
65#[deny(rustdoc::invalid_html_tags)]
66#[doc=include_str!("../CHANGELOG.md")]
67pub mod doc_changelog {}
68
69#[cfg(not(feature = "minimal-1"))]
70compile_error! { "You must enable (directly or indirectly) the derive-deftly crate feature `minimal-1`!" }