pub unsafe trait PhpClosure {
fn invoke<'a>(&'a mut self, parser: ArgParser<'a, '_>, ret: &mut Zval);
}
This is supported on crate feature closure
only.
Expand description
Implemented on types which can be used as PHP closures.
Types must implement the invoke
function which will be called when the
closure is called from PHP. Arguments must be parsed from the
ExecuteData
and the return value is returned through the Zval
.
This trait is automatically implemented on functions with up to 8
parameters.
impl<A, B, C, D, Ret> PhpClosure for Box<dyn Fn(A, B, C, D) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
Ret: IntoZval,
impl<A, B, C, D, Ret> PhpClosure for Box<dyn FnMut(A, B, C, D) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
Ret: IntoZval,
impl<A, B, C, D, E, Ret> PhpClosure for Box<dyn Fn(A, B, C, D, E) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
for<'a> E: FromZval<'a>,
Ret: IntoZval,
impl<A, B, C, D, E, Ret> PhpClosure for Box<dyn FnMut(A, B, C, D, E) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
for<'a> E: FromZval<'a>,
Ret: IntoZval,
impl<A, B, C, D, E, F, Ret> PhpClosure for Box<dyn Fn(A, B, C, D, E, F) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
for<'a> E: FromZval<'a>,
for<'a> F: FromZval<'a>,
Ret: IntoZval,
impl<A, B, C, D, E, F, Ret> PhpClosure for Box<dyn FnMut(A, B, C, D, E, F) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
for<'a> E: FromZval<'a>,
for<'a> F: FromZval<'a>,
Ret: IntoZval,
impl<A, B, C, D, E, F, G, Ret> PhpClosure for Box<dyn Fn(A, B, C, D, E, F, G) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
for<'a> E: FromZval<'a>,
for<'a> F: FromZval<'a>,
for<'a> G: FromZval<'a>,
Ret: IntoZval,
impl<A, B, C, D, E, F, G, Ret> PhpClosure for Box<dyn FnMut(A, B, C, D, E, F, G) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
for<'a> E: FromZval<'a>,
for<'a> F: FromZval<'a>,
for<'a> G: FromZval<'a>,
Ret: IntoZval,
impl<A, B, C, D, E, F, G, H, Ret> PhpClosure for Box<dyn Fn(A, B, C, D, E, F, G, H) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
for<'a> E: FromZval<'a>,
for<'a> F: FromZval<'a>,
for<'a> G: FromZval<'a>,
for<'a> H: FromZval<'a>,
Ret: IntoZval,
impl<A, B, C, D, E, F, G, H, Ret> PhpClosure for Box<dyn FnMut(A, B, C, D, E, F, G, H) -> Ret> where
for<'a> A: FromZval<'a>,
for<'a> B: FromZval<'a>,
for<'a> C: FromZval<'a>,
for<'a> D: FromZval<'a>,
for<'a> E: FromZval<'a>,
for<'a> F: FromZval<'a>,
for<'a> G: FromZval<'a>,
for<'a> H: FromZval<'a>,
Ret: IntoZval,