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