mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
remove use of hidden api in support procedural (#2383)
This commit is contained in:
committed by
Bastian Köcher
parent
93bc03cfe6
commit
07d495d905
@@ -27,30 +27,6 @@ use quote::quote;
|
||||
|
||||
pub mod syn_ext;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! custom_keyword_impl {
|
||||
($name:ident, $keyident:expr, $keydisp:expr) => {
|
||||
|
||||
impl CustomKeyword for $name {
|
||||
fn ident() -> &'static str { $keyident }
|
||||
fn display() -> &'static str { $keydisp }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! custom_keyword {
|
||||
($name:ident, $keyident:expr, $keydisp:expr) => {
|
||||
|
||||
#[derive(Debug)]
|
||||
struct $name;
|
||||
|
||||
custom_keyword_impl!($name, $keyident, $keydisp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME #1569, remove the following functions, which are copied from sr-api-macros
|
||||
use proc_macro2::{TokenStream, Span};
|
||||
use syn::Ident;
|
||||
|
||||
@@ -23,7 +23,6 @@ use syn::parse::{
|
||||
ParseStream,
|
||||
Result,
|
||||
};
|
||||
use syn::token::CustomKeyword;
|
||||
use proc_macro2::TokenStream as T2;
|
||||
use quote::{ToTokens, quote};
|
||||
use std::iter::once;
|
||||
@@ -72,32 +71,6 @@ groups_impl!(Braces, Brace, Brace, parse_braces);
|
||||
groups_impl!(Brackets, Bracket, Bracket, parse_brackets);
|
||||
groups_impl!(Parens, Paren, Parenthesis, parse_parens);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CustomToken<T>(std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: CustomKeyword> Parse for CustomToken<T> {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
let ident: syn::Ident = input.parse()?;
|
||||
|
||||
if ident.to_string().as_str() != T::ident() {
|
||||
return Err(syn::parse::Error::new_spanned(ident, "expected another custom token"))
|
||||
}
|
||||
Ok(CustomToken(std::marker::PhantomData))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: CustomKeyword> ToTokens for CustomToken<T> {
|
||||
fn to_tokens(&self, tokens: &mut T2) {
|
||||
use std::str::FromStr;
|
||||
tokens.extend(T2::from_str(T::ident()).expect("custom keyword should parse to ident"));
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: CustomKeyword> CustomKeyword for CustomToken<T> {
|
||||
fn ident() -> &'static str { <T as CustomKeyword>::ident() }
|
||||
fn display() -> &'static str { <T as CustomKeyword>::display() }
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PunctuatedInner<P,T,V> {
|
||||
pub inner: syn::punctuated::Punctuated<P,T>,
|
||||
|
||||
Reference in New Issue
Block a user