diff options
author | 2023-06-27 22:37:24 +0200 | |
---|---|---|
committer | 2023-06-27 22:37:24 +0200 | |
commit | e80b500370e71b8cd7dd64be4080cee0a3e5068f (patch) | |
tree | 130b5288bf5f8420482a1aaf021f2054b5687f04 /rust/macros/helpers.rs | |
parent | Merge branch 'for-6.5/amd-sfh' into for-linus (diff) | |
parent | HID: apple: Option to swap only left side mod keys (diff) | |
download | wireguard-linux-e80b500370e71b8cd7dd64be4080cee0a3e5068f.tar.xz wireguard-linux-e80b500370e71b8cd7dd64be4080cee0a3e5068f.zip |
Merge branch 'for-6.5/apple' into for-linus
- improved support for Keychron K8 keyboard (Lasse Brun)
Diffstat (limited to 'rust/macros/helpers.rs')
-rw-r--r-- | rust/macros/helpers.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/rust/macros/helpers.rs b/rust/macros/helpers.rs index cf7ad950dc1e..b2bdd4d8c958 100644 --- a/rust/macros/helpers.rs +++ b/rust/macros/helpers.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 -use proc_macro::{token_stream, TokenTree}; +use proc_macro::{token_stream, Group, TokenTree}; pub(crate) fn try_ident(it: &mut token_stream::IntoIter) -> Option<String> { if let Some(TokenTree::Ident(ident)) = it.next() { @@ -56,6 +56,14 @@ pub(crate) fn expect_string_ascii(it: &mut token_stream::IntoIter) -> String { string } +pub(crate) fn expect_group(it: &mut token_stream::IntoIter) -> Group { + if let TokenTree::Group(group) = it.next().expect("Reached end of token stream for Group") { + group + } else { + panic!("Expected Group"); + } +} + pub(crate) fn expect_end(it: &mut token_stream::IntoIter) { if it.next().is_some() { panic!("Expected end"); |