Skip to content

Commit 6b4efac

Browse files
committed
impl Clone for FunctionInfo
1 parent 443a2c8 commit 6b4efac

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/types/function_info.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl MiddlewareType {
2525
}
2626

2727
#[pyclass]
28-
#[derive(Debug, Clone)]
28+
#[derive(Debug)]
2929
pub struct FunctionInfo {
3030
#[pyo3(get, set)]
3131
pub handler: Py<PyAny>,
@@ -58,3 +58,17 @@ impl FunctionInfo {
5858
}
5959
}
6060
}
61+
62+
impl Clone for FunctionInfo {
63+
fn clone(&self) -> Self {
64+
Python::with_gil(|py| {
65+
Self {
66+
handler: self.handler.clone_ref(py),
67+
is_async: self.is_async,
68+
number_of_params: self.number_of_params,
69+
args: self.args.clone_ref(py),
70+
kwargs: self.kwargs.clone_ref(py),
71+
}
72+
})
73+
}
74+
}

0 commit comments

Comments
 (0)