@@ -2,7 +2,7 @@ use crate::func::args::{ArgInfo, ArgList};
2
2
use crate :: func:: error:: FunctionError ;
3
3
use crate :: func:: info:: FunctionInfo ;
4
4
use crate :: func:: return_type:: Return ;
5
- use crate :: func:: ReturnInfo ;
5
+ use crate :: func:: { IntoFunction , ReturnInfo } ;
6
6
use alloc:: borrow:: Cow ;
7
7
use core:: fmt:: { Debug , Formatter } ;
8
8
use std:: ops:: DerefMut ;
@@ -90,8 +90,6 @@ pub type FunctionResult<'a> = Result<Return<'a>, FunctionError>;
90
90
/// // Check the result:
91
91
/// assert_eq!(list, vec!["Hello, World!!!"]);
92
92
/// ```
93
- ///
94
- /// [`IntoFunction`]: crate::func::IntoFunction
95
93
pub struct DynamicFunction < ' env > {
96
94
info : FunctionInfo ,
97
95
func : Box < dyn for < ' a > FnMut ( ArgList < ' a > , & FunctionInfo ) -> FunctionResult < ' a > + ' env > ,
@@ -120,7 +118,6 @@ impl<'env> DynamicFunction<'env> {
120
118
/// the default name will always be the full path to the function as returned by [`std::any::type_name`].
121
119
///
122
120
/// [`DynamicFunctions`]: DynamicFunction
123
- /// [`IntoFunction`]: crate::func::IntoFunction
124
121
pub fn with_name ( mut self , name : impl Into < Cow < ' static , str > > ) -> Self {
125
122
self . info = self . info . with_name ( name) ;
126
123
self
@@ -214,3 +211,10 @@ impl<'env> Debug for DynamicFunction<'env> {
214
211
write ! ( f, ") -> {ret})" )
215
212
}
216
213
}
214
+
215
+ impl < ' env > IntoFunction < ' env , ( ) > for DynamicFunction < ' env > {
216
+ #[ inline]
217
+ fn into_function ( self ) -> DynamicFunction < ' env > {
218
+ self
219
+ }
220
+ }
0 commit comments