Skip to content

Commit

Permalink
[runtime] relax Fn trait bound
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingerZhu committed Apr 1, 2024
1 parent 75cd493 commit 77cbc4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rura-internal-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn generate_from_impl(total_cnt: usize) -> TokenStream {

quote::quote! {
impl<#(#full_ident : Clone + 'static,)*R : 'static, F> From<F> for Closure<(#(#full_ident,)*), R>
where F : Fn((#(#full_ident,)*)) -> R + Clone + 'static
where F : FnOnce((#(#full_ident,)*)) -> R + Clone + 'static
{
fn from(code: F) -> Self {
Closure (Rc::new(Thunk {
Expand Down
6 changes: 3 additions & 3 deletions rura-runtime/src/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ rura_internal_macros::generate_from_impls!();

pub struct Thunk<F, P: PartialParams, R>
where
F: Fn(P::Full) -> R + Clone,
F: FnOnce(P::Full) -> R + Clone,
{
code: F,
params: P,
}

impl<P: PartialParams + Clone, R, F> Clone for Thunk<F, P, R>
where
F: Fn(P::Full) -> R + Clone,
F: FnOnce(P::Full) -> R + Clone,
{
fn clone(&self) -> Self {
Thunk {
Expand All @@ -64,7 +64,7 @@ pub trait BoxedClosure<P: Params, R> {

impl<F, P, R> BoxedClosure<P::Pending, R> for Thunk<F, P, R>
where
F: Fn(P::Full) -> R + Clone + 'static,
F: FnOnce(P::Full) -> R + Clone + 'static,
P: PartialParams + Clone + 'static,
R: 'static,
{
Expand Down

0 comments on commit 77cbc4e

Please sign in to comment.