Skip to content

Commit 1bd03df

Browse files
committed
Rename Args to Multi
1 parent 2c679b4 commit 1bd03df

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

macros/src/memoize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn process(function: &Function) -> Result<TokenStream> {
134134
// Construct the inner closure.
135135
let output = &function.output;
136136
let body = &function.item.block;
137-
let closure = quote! { |::comemo::internal::Args(#param_tuple)| -> #output #body };
137+
let closure = quote! { |::comemo::internal::Multi(#param_tuple)| -> #output #body };
138138

139139
// Adjust the function's body.
140140
let mut wrapped = function.item.clone();
@@ -148,7 +148,7 @@ fn process(function: &Function) -> Result<TokenStream> {
148148

149149
wrapped.block = parse_quote! { {
150150
static __CACHE: ::comemo::internal::Cache<
151-
<::comemo::internal::Args<#arg_ty_tuple> as ::comemo::internal::Input>::Constraint,
151+
<::comemo::internal::Multi<#arg_ty_tuple> as ::comemo::internal::Input>::Constraint,
152152
#output,
153153
> = ::comemo::internal::Cache::new(|| {
154154
::comemo::internal::register_evictor(|max_age| __CACHE.evict(max_age));
@@ -158,7 +158,7 @@ fn process(function: &Function) -> Result<TokenStream> {
158158
#(#bounds;)*
159159

160160
::comemo::internal::memoized(
161-
::comemo::internal::Args(#arg_tuple),
161+
::comemo::internal::Multi(#arg_tuple),
162162
&::core::default::Default::default(),
163163
&__CACHE,
164164
#enabled,

src/input.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ where
117117
}
118118

119119
/// Wrapper for multiple inputs.
120-
pub struct Args<T>(pub T);
120+
pub struct Multi<T>(pub T);
121121

122-
macro_rules! args_input {
122+
macro_rules! multi {
123123
($($param:tt $alt:tt $idx:tt ),*) => {
124124
#[allow(unused_variables, non_snake_case)]
125-
impl<'a, $($param: Input<'a>),*> Input<'a> for Args<($($param,)*)> {
125+
impl<'a, $($param: Input<'a>),*> Input<'a> for Multi<($($param,)*)> {
126126
type Constraint = ($($param::Constraint,)*);
127127
type Outer = ($($param::Outer,)*);
128128

@@ -147,7 +147,7 @@ macro_rules! args_input {
147147
constraint: &'a Self::Constraint,
148148
) -> (Self, Self::Outer) {
149149
$(let $param = (self.0).$idx.retrack(&constraint.$idx);)*
150-
(Args(($($param.0,)*)), ($($param.1,)*))
150+
(Multi(($($param.0,)*)), ($($param.1,)*))
151151
}
152152
}
153153

@@ -166,16 +166,16 @@ macro_rules! args_input {
166166
};
167167
}
168168

169-
args_input! {}
170-
args_input! { A Z 0 }
171-
args_input! { A Z 0, B Y 1 }
172-
args_input! { A Z 0, B Y 1, C X 2 }
173-
args_input! { A Z 0, B Y 1, C X 2, D W 3 }
174-
args_input! { A Z 0, B Y 1, C X 2, D W 3, E V 4 }
175-
args_input! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5 }
176-
args_input! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6 }
177-
args_input! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7 }
178-
args_input! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7, I R 8 }
179-
args_input! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7, I R 8, J Q 9 }
180-
args_input! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7, I R 8, J Q 9, K P 10 }
181-
args_input! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7, I R 8, J Q 9, K P 10, L O 11 }
169+
multi! {}
170+
multi! { A Z 0 }
171+
multi! { A Z 0, B Y 1 }
172+
multi! { A Z 0, B Y 1, C X 2 }
173+
multi! { A Z 0, B Y 1, C X 2, D W 3 }
174+
multi! { A Z 0, B Y 1, C X 2, D W 3, E V 4 }
175+
multi! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5 }
176+
multi! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6 }
177+
multi! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7 }
178+
multi! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7, I R 8 }
179+
multi! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7, I R 8, J Q 9 }
180+
multi! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7, I R 8, J Q 9, K P 10 }
181+
multi! { A Z 0, B Y 1, C X 2, D W 3, E V 4, F U 5, G T 6, H S 7, I R 8, J Q 9, K P 10, L O 11 }

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub mod internal {
110110
pub use crate::cache::{Cache, CacheData, memoized, register_evictor};
111111
pub use crate::constraint::{Call, ImmutableConstraint, MutableConstraint};
112112
pub use crate::hash::hash;
113-
pub use crate::input::{Args, Input, assert_hashable_or_trackable};
113+
pub use crate::input::{Input, Multi, assert_hashable_or_trackable};
114114
pub use crate::track::{Surfaces, to_parts_mut_mut, to_parts_mut_ref, to_parts_ref};
115115

116116
#[cfg(feature = "testing")]

0 commit comments

Comments
 (0)