1use super::*;
4#[allow(unreachable_pub)] pub use crate::{
6 ast_enum::Type,
7 ast_struct::{
8 Abi, BareFnArg, BareVariadic, TypeArray, TypeBareFn, TypeGroup, TypeImplTrait, TypeMacro,
9 TypeParen, TypePath, TypePtr, TypeReference, TypeSlice, TypeTraitObject, TypeTuple,
10 Variadic,
11 },
12};
13
14ast_struct! {
15 #[derive(Default)]
17 #[serde(transparent)]
18 pub struct ReturnType {
19 ty: Option<Box<Type>>,
20 }
21}
22
23mod convert {
24 use super::*;
25
26 syn_trait_impl!(syn::ReturnType);
28 impl From<&syn::ReturnType> for ReturnType {
29 fn from(other: &syn::ReturnType) -> Self {
30 use syn::ReturnType;
31 match other {
32 ReturnType::Default => Self { ty: None },
33 ReturnType::Type(_, x) => Self { ty: Some(x.map_into()) },
34 }
35 }
36 }
37 impl From<&ReturnType> for syn::ReturnType {
38 fn from(other: &ReturnType) -> Self {
39 use syn::ReturnType;
40 match &other.ty {
41 None => ReturnType::Default,
42 Some(x) => ReturnType::Type(default(), x.map_into()),
43 }
44 }
45 }
46}