public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] libproc_macro: Add token_stream module interface
@ 2023-04-06 21:30 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-06 21:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:553ffc74645b34a8b0a52bcd77a7499ca4f74d37

commit 553ffc74645b34a8b0a52bcd77a7499ca4f74d37
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Mon Feb 13 18:02:25 2023 +0100

    libproc_macro: Add token_stream module interface
    
    Add the token_stream rust module interface to libproc_macro in order to
    provide public implementation details for the TokenStream type such as
    iterators.
    
    ChangeLog:
    
            * librust/proc_macro/rust/lib.rs: Add token_stream module.
            * librust/proc_macro/rust/token_stream.rs: Add iterator.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 librust/proc_macro/rust/lib.rs          |  1 +
 librust/proc_macro/rust/token_stream.rs | 34 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/librust/proc_macro/rust/lib.rs b/librust/proc_macro/rust/lib.rs
index 65cf8eb2bce..2e91dd32e4a 100644
--- a/librust/proc_macro/rust/lib.rs
+++ b/librust/proc_macro/rust/lib.rs
@@ -11,6 +11,7 @@ mod ident;
 mod literal;
 mod punct;
 mod span;
+pub mod token_stream;
 
 /// Determines whether proc_macro has been made accessible to the currently
 /// running program.
diff --git a/librust/proc_macro/rust/token_stream.rs b/librust/proc_macro/rust/token_stream.rs
new file mode 100644
index 00000000000..3de89dfa35f
--- /dev/null
+++ b/librust/proc_macro/rust/token_stream.rs
@@ -0,0 +1,34 @@
+//! Public implementation details for the `TokenStream` type, such as iterators.
+use TokenStream;
+use TokenTree;
+
+/// An iterator over [`TokenStream`]'s [`TokenTree`]s.
+#[derive(Clone)]
+pub struct IntoIter {
+    // Internal implementation details
+}
+
+impl Iterator for IntoIter {
+    type Item = TokenTree;
+
+    fn next(&mut self) -> Option<TokenTree> {
+        todo!("Implement this function")
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        todo!("Implement this function")
+    }
+
+    fn count(self) -> usize {
+        todo!("Implement this function")
+    }
+}
+
+impl IntoIterator for TokenStream {
+    type Item = TokenTree;
+    type IntoIter = IntoIter;
+
+    fn into_iter(self) -> IntoIter {
+        todo!("Implement this function")
+    }
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-06 21:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-06 21:30 [gcc/devel/rust/master] libproc_macro: Add token_stream module interface Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).