This repository was archived by the owner on Oct 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-13
lines changed Expand file tree Collapse file tree 2 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -117,10 +117,10 @@ The precise Unicode conversions are as defined by [`str::to_lowercase`] and
117117
118118<br >
119119
120- ## Pasting documentation strings
120+ ## Pasting string literals into attributes
121121
122- Within the ` paste! ` macro, arguments to a # \[ doc ... \] attribute are implicitly
123- concatenated together to form a coherent documentation string.
122+ Within the ` paste! ` macro, if there are two or more arguments to an attribute they are implicitly
123+ concatenated together to form a string literal .
124124
125125``` rust
126126use paste :: paste;
@@ -129,14 +129,18 @@ macro_rules! method_new {
129129 ($ ret : ident ) => {
130130 paste! {
131131 #[doc = " Create a new `" $ ret " ` object." ]
132+ #[cfg(feature = "" $ ret: snake)]
132133 pub fn new () -> $ ret { todo! () }
133134 }
134135 };
135136}
136137
137138pub struct Paste {}
138139
139- method_new! (Paste ); // expands to #[doc = "Create a new `Paste` object"]
140+ // expands to:
141+ // #[doc = "Create a new `Paste` object."]
142+ // #[cfg(feature = "paste")]
143+ method_new! (Paste , 32 );
140144```
141145
142146<br >
Original file line number Diff line number Diff line change 115115//!
116116//! <br>
117117//!
118- //! # Pasting documentation strings
119- //!
120- //! Within the `paste!` macro, arguments to a #\[doc ...\] attribute are
121- //! implicitly concatenated together to form a coherent documentation string.
122- //!
118+ //! ## Pasting string literals into attributes
119+ //!
120+ //! Within the `paste!` macro, if there are two or more arguments to an attribute they are implicitly
121+ //! concatenated together to form a string literal .
122+ //!
123123//! ```
124124//! use paste::paste;
125- //!
125+ //!
126126//! macro_rules! method_new {
127127//! ($ret:ident) => {
128128//! paste! {
129129//! #[doc = "Create a new `" $ret "` object."]
130+ //! #[cfg(feature = "" $ret:snake)]
130131//! pub fn new() -> $ret { todo!() }
131132//! }
132133//! };
133134//! }
134- //!
135+ //!
135136//! pub struct Paste {}
136- //!
137- //! method_new!(Paste); // expands to #[doc = "Create a new `Paste` object"]
137+ //!
138+ //! // expands to:
139+ //! // #[doc = "Create a new `Paste` object."]
140+ //! // #[cfg(feature = "paste")]
141+ //! method_new!(Paste, 32);
138142//! ```
139143
140144#![ doc( html_root_url = "https://docs.rs/paste/1.0.15" ) ]
You can’t perform that action at this time.
0 commit comments