考虑下面的代码-它编译并工作: use std::rc::Rc;use crate::Foo::{Something, Nothing};
Nothing,}
let wrapped = Rc::new(RefCell::new(Foo::Nothing("Nothing"),} 现在我想匹配两个包装值,而不是只匹配一个: use std::rc::Rc
是否有可能在锈蚀中创建RefCell<Any>类型的东西?我尝试了以下几点: return RefCell::new(x) as RefCell<Any>但我得到了以下错误not implemented for the type `core::any::Any + 'static` [E0277]
<anon>:8 fn test2<T : An
我之所以使用RefCell,是因为据我所知,它是完成这项工作的工具。如何访问(和更改)该Option<T>的内容?我尝试了以下几种方法:struct S {}
letrc: RefCell<Option<S>> = RefCell::new(Some(S{val: 0}));
if let Some(ref mut s2) = rc.