api-macros: Rename RawErrorType => ErrorType

This commit is contained in:
Jonas Platte 2020-11-27 21:02:25 +01:00
parent 4d9fdeb61d
commit 183f427143
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -393,13 +393,6 @@ impl ToTokens for Api {
} }
} }
/// Custom keyword macros for syn.
mod kw {
use syn::custom_keyword;
custom_keyword!(error);
}
/// The entire `ruma_api!` macro structure directly as it appears in the source code.. /// The entire `ruma_api!` macro structure directly as it appears in the source code..
pub struct RawApi { pub struct RawApi {
/// The `metadata` section of the macro. /// The `metadata` section of the macro.
@ -412,7 +405,7 @@ pub struct RawApi {
pub response: Response, pub response: Response,
/// The `error` section of the macro. /// The `error` section of the macro.
pub error: Option<RawErrorType>, pub error: Option<ErrorType>,
} }
impl Parse for RawApi { impl Parse for RawApi {
@ -426,12 +419,16 @@ impl Parse for RawApi {
} }
} }
pub struct RawErrorType { mod kw {
syn::custom_keyword!(error);
}
pub struct ErrorType {
pub error_kw: kw::error, pub error_kw: kw::error,
pub ty: Type, pub ty: Type,
} }
impl Parse for RawErrorType { impl Parse for ErrorType {
fn parse(input: ParseStream<'_>) -> syn::Result<Self> { fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let error_kw = input.parse::<kw::error>()?; let error_kw = input.parse::<kw::error>()?;
input.parse::<Token![:]>()?; input.parse::<Token![:]>()?;