We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b761e47 + 4f74b68 commit 32f2043Copy full SHA for 32f2043
src/lib.rs
@@ -118,6 +118,14 @@ impl TokenStream {
118
}
119
120
121
+/// `TokenStream::default()` returns an empty stream,
122
+/// i.e. this is equivalent with `TokenStream::new()`.
123
+impl Default for TokenStream {
124
+ fn default() -> Self {
125
+ TokenStream::new()
126
+ }
127
+}
128
+
129
/// Attempts to break the string into tokens and parse those tokens into a token
130
/// stream.
131
///
tests/test.rs
@@ -381,3 +381,10 @@ TokenStream [
381
382
assert_eq!(expected, format!("{:#?}", tts));
383
384
385
+#[test]
386
+fn default_tokenstream_is_empty() {
387
+ let default_token_stream: TokenStream = Default::default();
388
389
+ assert!(default_token_stream.is_empty());
390
0 commit comments