aboutsummaryrefslogtreecommitdiff
path: root/macros/src/factory
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-08-15 23:15:19 +0200
committerHampusM <hampus@hampusmat.com>2023-08-15 23:18:59 +0200
commite381ae3b8649de47ba46925e402946658ac16d20 (patch)
tree32ecc7e4592f25d43dc1e76399d3fffae3272e1e /macros/src/factory
parent9423d67efb161d9a94a7ab6c5899c6bc7ecaee7c (diff)
fix!: make the factory macro not change its input
BREAKING CHANGE: The factory macro no longer - Changes the return type to be inside of a TransientPtr - Adds Send + Sync bounds when the threadsafe or the async flag is set - Changes the return type be inside of a BoxFuture when the async flag is set
Diffstat (limited to 'macros/src/factory')
-rw-r--r--macros/src/factory/type_alias.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/macros/src/factory/type_alias.rs b/macros/src/factory/type_alias.rs
index 790175b..fafcd54 100644
--- a/macros/src/factory/type_alias.rs
+++ b/macros/src/factory/type_alias.rs
@@ -1,7 +1,6 @@
use quote::ToTokens;
use syn::parse::{Parse, ParseStream};
-use syn::punctuated::Punctuated;
-use syn::{parse2, ItemType, Token, Type};
+use syn::{parse2, ItemType};
use crate::fn_trait::FnTrait;
@@ -9,8 +8,6 @@ pub struct FactoryTypeAlias
{
pub type_alias: ItemType,
pub factory_interface: FnTrait,
- pub arg_types: Punctuated<Type, Token![,]>,
- pub return_type: Type,
}
impl Parse for FactoryTypeAlias
@@ -27,8 +24,6 @@ impl Parse for FactoryTypeAlias
Ok(Self {
type_alias,
factory_interface: aliased_fn_trait.clone(),
- arg_types: aliased_fn_trait.inputs,
- return_type: aliased_fn_trait.output,
})
}
}
@@ -39,8 +34,9 @@ mod tests
use std::error::Error;
use quote::{format_ident, quote};
+ use syn::punctuated::Punctuated;
use syn::token::And;
- use syn::TypeReference;
+ use syn::{Type, TypeReference};
use super::*;
use crate::test_utils;
@@ -55,7 +51,7 @@ mod tests
let factory_type_alias = parse2::<FactoryTypeAlias>(input_args)?;
assert_eq!(
- factory_type_alias.arg_types,
+ factory_type_alias.factory_interface.inputs,
Punctuated::from_iter(vec![
test_utils::create_type(test_utils::create_path(&[
test_utils::create_path_segment(format_ident!("String"), &[])