我想修改笔记本里的一些数据。
我在www.example.com上看到了使用衬垫的示例https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/blob/0.18.8/examples/src/bin/pad_probes.rs#L40
因为回调类型是func: F
,所以我只能使用不修改任何捕获内容的回调。我尝试简单地在闭包中使用我的一个变量,得到了以下结果:
error[E0594]: cannot assign to `self.frame_id`, as `Fn` closures cannot mutate their captured variables
--> src/decoding_branch.rs:161:13
|
161 | self.frame_id += 1;
| ^^^^^^^^^^^^^^^^^^ cannot assign
我该怎么改变卫生纸上的东西?
1条答案
按热度按时间hmae6n7t1#
我的错。我应该使用Cannot borrow captured outer variable in an
Fn
closure as mutable之类的东西我尝试了以下方法来检查此方法
而且看起来很有效。