|
0 |
--- a/src/dense.rs
|
|
1 |
+++ b/src/dense.rs
|
|
2 |
@@ -119,7 +119,7 @@
|
|
3 |
/// This type implements the [`DFA`](trait.DFA.html) trait, which means it
|
|
4 |
/// can be used for searching. For example:
|
|
5 |
///
|
|
6 |
-/// ```
|
|
7 |
+#[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
8 |
/// use regex_automata::{DFA, DenseDFA};
|
|
9 |
///
|
|
10 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
11 |
@@ -502,7 +502,7 @@
|
|
12 |
/// decrease the size of the DFA and to avoid platform specific pitfalls
|
|
13 |
/// such as differing pointer sizes.
|
|
14 |
///
|
|
15 |
- /// ```
|
|
16 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
17 |
/// use regex_automata::{DFA, DenseDFA};
|
|
18 |
///
|
|
19 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
20 |
@@ -2246,6 +2246,7 @@
|
|
21 |
String::from_utf8(ascii::escape_default(b).collect::<Vec<_>>()).unwrap()
|
|
22 |
}
|
|
23 |
|
|
24 |
+#[cfg(feature = "std")]
|
|
25 |
#[cfg(test)]
|
|
26 |
#[allow(dead_code)]
|
|
27 |
mod tests {
|
|
28 |
--- a/tests/tests.rs
|
|
29 |
+++ b/tests/tests.rs
|
|
30 |
@@ -10,7 +10,10 @@
|
|
31 |
extern crate serde_derive;
|
|
32 |
extern crate toml;
|
|
33 |
|
|
34 |
+#[cfg(feature = "std")]
|
|
35 |
mod collection;
|
|
36 |
+#[cfg(feature = "std")]
|
|
37 |
mod regression;
|
|
38 |
+#[cfg(feature = "std")]
|
|
39 |
mod suite;
|
|
40 |
mod unescape;
|
|
41 |
--- a/src/dfa.rs
|
|
42 |
+++ b/src/dfa.rs
|
|
43 |
@@ -78,7 +78,7 @@
|
|
44 |
/// This example shows how to use this method with a
|
|
45 |
/// [`DenseDFA`](enum.DenseDFA.html).
|
|
46 |
///
|
|
47 |
- /// ```
|
|
48 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
49 |
/// use regex_automata::{DFA, DenseDFA};
|
|
50 |
///
|
|
51 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
52 |
@@ -104,7 +104,7 @@
|
|
53 |
/// This example shows how to use this method with a
|
|
54 |
/// [`DenseDFA`](enum.DenseDFA.html).
|
|
55 |
///
|
|
56 |
- /// ```
|
|
57 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
58 |
/// use regex_automata::{DFA, DenseDFA};
|
|
59 |
///
|
|
60 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
61 |
@@ -153,7 +153,7 @@
|
|
62 |
/// both `Sam|Samwise` and `Samwise|Sam` match `Samwise` when using
|
|
63 |
/// leftmost longest semantics.
|
|
64 |
///
|
|
65 |
- /// ```
|
|
66 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
67 |
/// use regex_automata::{DFA, DenseDFA};
|
|
68 |
///
|
|
69 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
70 |
@@ -187,7 +187,7 @@
|
|
71 |
/// `find` and `rfind` with the same DFA since any particular DFA will only
|
|
72 |
/// support searching in one direction.
|
|
73 |
///
|
|
74 |
- /// ```
|
|
75 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
76 |
/// use regex_automata::{dense, DFA};
|
|
77 |
///
|
|
78 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
79 |
--- a/src/lib.rs
|
|
80 |
+++ b/src/lib.rs
|
|
81 |
@@ -29,7 +29,7 @@
|
|
82 |
This example shows how to compile a regex using the default configuration
|
|
83 |
and then use it to find matches in a byte string:
|
|
84 |
|
|
85 |
-```
|
|
86 |
+*/#![cfg_attr(feature = "std", doc = "```")] #![cfg_attr(not(feature = "std"), doc = "```ignore")]/*!
|
|
87 |
use regex_automata::Regex;
|
|
88 |
|
|
89 |
let re = Regex::new(r"[0-9]{4}-[0-9]{2}-[0-9]{2}").unwrap();
|
|
90 |
@@ -48,7 +48,7 @@
|
|
91 |
Using sparse DFAs is as easy as using `Regex::new_sparse` instead of
|
|
92 |
`Regex::new`:
|
|
93 |
|
|
94 |
-```
|
|
95 |
+*/#![cfg_attr(feature = "std", doc = "```")] #![cfg_attr(not(feature = "std"), doc = "```ignore")]/*!
|
|
96 |
use regex_automata::Regex;
|
|
97 |
|
|
98 |
# fn example() -> Result<(), regex_automata::Error> {
|
|
99 |
@@ -62,7 +62,7 @@
|
|
100 |
If you already have dense DFAs for some reason, they can be converted to sparse
|
|
101 |
DFAs and used to build a new `Regex`. For example:
|
|
102 |
|
|
103 |
-```
|
|
104 |
+*/#![cfg_attr(feature = "std", doc = "```")] #![cfg_attr(not(feature = "std"), doc = "```ignore")]/*!
|
|
105 |
use regex_automata::Regex;
|
|
106 |
|
|
107 |
# fn example() -> Result<(), regex_automata::Error> {
|
|
108 |
@@ -86,7 +86,7 @@
|
|
109 |
deserialization is guaranteed to be cheap because it will always be a constant
|
|
110 |
time operation.
|
|
111 |
|
|
112 |
-```
|
|
113 |
+*/#![cfg_attr(feature = "std", doc = "```")] #![cfg_attr(not(feature = "std"), doc = "```ignore")]/*!
|
|
114 |
use regex_automata::{DenseDFA, Regex};
|
|
115 |
|
|
116 |
# fn example() -> Result<(), regex_automata::Error> {
|
|
117 |
@@ -139,7 +139,7 @@
|
|
118 |
|
|
119 |
The same process can be achieved with sparse DFAs as well:
|
|
120 |
|
|
121 |
-```
|
|
122 |
+*/#![cfg_attr(feature = "std", doc = "```")] #![cfg_attr(not(feature = "std"), doc = "```ignore")]/*!
|
|
123 |
use regex_automata::{SparseDFA, Regex};
|
|
124 |
|
|
125 |
# fn example() -> Result<(), regex_automata::Error> {
|
|
126 |
--- a/src/regex.rs
|
|
127 |
+++ b/src/regex.rs
|
|
128 |
@@ -86,7 +86,7 @@
|
|
129 |
/// enough to build corresponding sparse DFAs, and then build a regex from
|
|
130 |
/// them:
|
|
131 |
///
|
|
132 |
-/// ```
|
|
133 |
+#[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
134 |
/// use regex_automata::Regex;
|
|
135 |
///
|
|
136 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
137 |
@@ -179,7 +179,7 @@
|
|
138 |
///
|
|
139 |
/// # Example
|
|
140 |
///
|
|
141 |
- /// ```
|
|
142 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
143 |
/// use regex_automata::Regex;
|
|
144 |
///
|
|
145 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
146 |
@@ -201,7 +201,7 @@
|
|
147 |
///
|
|
148 |
/// # Example
|
|
149 |
///
|
|
150 |
- /// ```
|
|
151 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
152 |
/// use regex_automata::Regex;
|
|
153 |
///
|
|
154 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
155 |
@@ -235,7 +235,7 @@
|
|
156 |
///
|
|
157 |
/// # Example
|
|
158 |
///
|
|
159 |
- /// ```
|
|
160 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
161 |
/// use regex_automata::Regex;
|
|
162 |
///
|
|
163 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
164 |
@@ -313,7 +313,7 @@
|
|
165 |
///
|
|
166 |
/// # Example
|
|
167 |
///
|
|
168 |
- /// ```
|
|
169 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
170 |
/// use regex_automata::Regex;
|
|
171 |
///
|
|
172 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
173 |
@@ -342,7 +342,7 @@
|
|
174 |
/// would involve serializing `initial_re` somewhere and then deserializing
|
|
175 |
/// it later to build a regex.
|
|
176 |
///
|
|
177 |
- /// ```
|
|
178 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
179 |
/// use regex_automata::Regex;
|
|
180 |
///
|
|
181 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
182 |
@@ -358,7 +358,7 @@
|
|
183 |
/// This example shows how you might build smaller DFAs, and then use those
|
|
184 |
/// smaller DFAs to build a new regex.
|
|
185 |
///
|
|
186 |
- /// ```
|
|
187 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
188 |
/// use regex_automata::Regex;
|
|
189 |
///
|
|
190 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
191 |
@@ -375,7 +375,7 @@
|
|
192 |
/// This example shows how to build a `Regex` that uses sparse DFAs instead
|
|
193 |
/// of dense DFAs:
|
|
194 |
///
|
|
195 |
- /// ```
|
|
196 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
197 |
/// use regex_automata::Regex;
|
|
198 |
///
|
|
199 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
200 |
--- a/src/sparse.rs
|
|
201 |
+++ b/src/sparse.rs
|
|
202 |
@@ -86,7 +86,7 @@
|
|
203 |
/// This type implements the [`DFA`](trait.DFA.html) trait, which means it
|
|
204 |
/// can be used for searching. For example:
|
|
205 |
///
|
|
206 |
-/// ```
|
|
207 |
+#[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
208 |
/// use regex_automata::{DFA, SparseDFA};
|
|
209 |
///
|
|
210 |
/// # fn example() -> Result<(), regex_automata::Error> {
|
|
211 |
@@ -393,7 +393,7 @@
|
|
212 |
/// decrease the size of the DFA and to avoid platform specific pitfalls
|
|
213 |
/// such as differing pointer sizes.
|
|
214 |
///
|
|
215 |
- /// ```
|
|
216 |
+ #[cfg_attr(feature = "std", doc = "```")] #[cfg_attr(not(feature = "std"), doc = "```ignore")]
|
|
217 |
/// use regex_automata::{DFA, DenseDFA, SparseDFA};
|
|
218 |
///
|
|
219 |
/// # fn example() -> Result<(), regex_automata::Error> {
|