3
我有以下幾點:如何將具有2個參數的函數作爲參數傳遞給函數?
fn apply_bin(&mut self, op: Fn(i32,i32)) -> Result<i32, String> {
}
,但我得到的錯誤:
<anon>:75:29: 75:31 error: the trait `core::marker::Sized` is not implemented for the type `core::ops::Fn(i32, i32) + 'static` [E0277]
<anon>:75 fn apply_bin(&mut self, op: Fn(i32,i32)) -> Result<i32, String> {
^~
這是爲什麼?如何解決?
謝謝!這似乎工作:D –