This repository was archived by the owner on Oct 6, 2024. It is now read-only.
File tree 2 files changed +21
-13
lines changed
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
117
117
118
118
<br >
119
119
120
- ## Pasting documentation strings
120
+ ## Pasting string literals into attributes
121
121
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 .
124
124
125
125
``` rust
126
126
use paste :: paste;
@@ -129,14 +129,18 @@ macro_rules! method_new {
129
129
($ ret : ident ) => {
130
130
paste! {
131
131
#[doc = " Create a new `" $ ret " ` object." ]
132
+ #[cfg(feature = "" $ ret: snake)]
132
133
pub fn new () -> $ ret { todo! () }
133
134
}
134
135
};
135
136
}
136
137
137
138
pub struct Paste {}
138
139
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 );
140
144
```
141
145
142
146
<br >
Original file line number Diff line number Diff line change 115
115
//!
116
116
//! <br>
117
117
//!
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
+ //!
123
123
//! ```
124
124
//! use paste::paste;
125
- //!
125
+ //!
126
126
//! macro_rules! method_new {
127
127
//! ($ret:ident) => {
128
128
//! paste! {
129
129
//! #[doc = "Create a new `" $ret "` object."]
130
+ //! #[cfg(feature = "" $ret:snake)]
130
131
//! pub fn new() -> $ret { todo!() }
131
132
//! }
132
133
//! };
133
134
//! }
134
- //!
135
+ //!
135
136
//! 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);
138
142
//! ```
139
143
140
144
#![ doc( html_root_url = "https://docs.rs/paste/1.0.15" ) ]
You can’t perform that action at this time.
0 commit comments