aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2019-08-10 17:51:58 -0700
committerDavid Tolnay <dtolnay@gmail.com>2019-08-10 17:51:58 -0700
commit35c085d4ae2d1e4d023382551321828d0ab851fd (patch)
treed13b840a4592e278f8a803b9f6f0e2b947c19fc1
parentdbe67ef8d9c144012ee941b412229e0cbd5872ee (diff)
downloadquote-35c085d4ae2d1e4d023382551321828d0ab851fd.tar.gz
Space apart rustdoc sections
-rw-r--r--src/format.rs10
-rw-r--r--src/lib.rs38
2 files changed, 42 insertions, 6 deletions
diff --git a/src/format.rs b/src/format.rs
index e7d7088..13c8811 100644
--- a/src/format.rs
+++ b/src/format.rs
@@ -1,5 +1,7 @@
/// Formatting macro for constructing `Ident`s.
///
+/// <br>
+///
/// # Syntax
///
/// Syntax is copied from the [`format!`] macro, supporting both positional and
@@ -16,6 +18,8 @@
///
/// See [`std::fmt`] for more information.
///
+/// <br>
+///
/// # IdentFragment
///
/// Unlike `format!`, this macro uses the [`IdentFragment`] formatting trait by
@@ -27,6 +31,8 @@
///
/// [`Ident`]: `proc_macro2::Ident`
///
+/// <br>
+///
/// # Hygiene
///
/// The [`Span`] of the first `Ident` argument is used as the span of the final
@@ -56,11 +62,15 @@
/// [`Span`]: `proc_macro2::Span`
/// [`Span::call_site`]: `proc_macro2::Span::call_site`
///
+/// <p><br></p>
+///
/// # Panics
///
/// This method will panic if the resulting formatted string is not a valid
/// identifier.
///
+/// <br>
+///
/// # Examples
///
/// Composing raw and non-raw identifiers:
diff --git a/src/lib.rs b/src/lib.rs
index 77e9491..91a8343 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,6 +26,8 @@
//! quote-next = "1.0.0-rc2"
//! ```
//!
+//! <br>
+//!
//! # Example
//!
//! The following quasi-quoted block of code is something you might find in [a]
@@ -107,6 +109,8 @@ pub mod spanned;
///
/// [`TokenStream`]: https://docs.rs/proc-macro2/0.4/proc_macro2/struct.TokenStream.html
///
+/// <br>
+///
/// # Interpolation
///
/// Variable interpolation is done with `#var` (similar to `$var` in
@@ -130,6 +134,8 @@ pub mod spanned;
/// - `#( struct #var; )*` — the repetition can contain other tokens
/// - `#( #k => println!("{}", #v), )*` — even multiple interpolations
///
+/// <br>
+///
/// # Hygiene
///
/// Any interpolated tokens preserve the `Span` information provided by their
@@ -142,6 +148,8 @@ pub mod spanned;
///
/// [`quote_spanned!`]: macro.quote_spanned.html
///
+/// <br>
+///
/// # Return type
///
/// The macro evaluates to an expression of type `proc_macro2::TokenStream`.
@@ -162,9 +170,11 @@ pub mod spanned;
///
/// [`From`]: https://doc.rust-lang.org/std/convert/trait.From.html
///
+/// <br>
+///
/// # Examples
///
-/// ## Procedural macro
+/// ### Procedural macro
///
/// The structure of a basic procedural macro is as follows. Refer to the [Syn]
/// crate for further useful guidance on using `quote!` as part of a procedural
@@ -209,7 +219,9 @@ pub mod spanned;
/// }
/// ```
///
-/// ## Combining quoted fragments
+/// <p><br></p>
+///
+/// ### Combining quoted fragments
///
/// Usually you don't end up constructing an entire final `TokenStream` in one
/// piece. Different parts may come from different helper functions. The tokens
@@ -228,7 +240,9 @@ pub mod spanned;
/// };
/// ```
///
-/// ## Constructing identifiers
+/// <p><br></p>
+///
+/// ### Constructing identifiers
///
/// Suppose we have an identifier `ident` which came from somewhere in a macro
/// input and we need to modify it in some way for the macro output. Let's
@@ -284,7 +298,9 @@ pub mod spanned;
/// # ;
/// ```
///
-/// ## Making method calls
+/// <p><br></p>
+///
+/// ### Making method calls
///
/// Let's say our macro requires some type specified in the macro input to have
/// a constructor called `new`. We have the type in a variable called
@@ -334,7 +350,9 @@ pub mod spanned;
/// # ;
/// ```
///
-/// ## Interpolating text inside of doc comments
+/// <p><br></p>
+///
+/// ### Interpolating text inside of doc comments
///
/// Neither doc comments nor string literals get interpolation behavior in
/// quote:
@@ -382,7 +400,9 @@ pub mod spanned;
/// # ;
/// ```
///
-/// ## Indexing into a tuple struct
+/// <p><br></p>
+///
+/// ### Indexing into a tuple struct
///
/// When interpolating indices of a tuple or tuple struct, we need them not to
/// appears suffixed as integer literals by interpolating them as [`syn::Index`]
@@ -448,6 +468,8 @@ macro_rules! quote {
/// Same as `quote!`, but applies a given span to all tokens originating within
/// the macro invocation.
///
+/// <br>
+///
/// # Syntax
///
/// A span expression of type [`Span`], followed by `=>`, followed by the tokens
@@ -482,12 +504,16 @@ macro_rules! quote {
/// being evaluated in the context of the procedural macro and the remaining
/// tokens being evaluated in the generated code.
///
+/// <br>
+///
/// # Hygiene
///
/// Any interpolated tokens preserve the `Span` information provided by their
/// `ToTokens` implementation. Tokens that originate within the `quote_spanned!`
/// invocation are spanned with the given span argument.
///
+/// <br>
+///
/// # Example
///
/// The following procedural macro code uses `quote_spanned!` to assert that a