long enough, because it gets allocated on the stack Ok(&mut foo)Rust在C中,您可以通过使用malloc在堆上分配对象来解决此问题,并且调用者需要知道在适当的时候调用free。在GCed语言中,这是可行的,因为foo会一直存在,直到没有引用它为止。Rust真的很聪明,介于两者之间,所以我不确定我的选择是什么。
我认为一种选择是返回托管指针类型。Box是最合适的吗?(我找到了
我想匹配一个枚举变体,处理它,然后再传递它。^^^^ = note: see issue #65490 <https://github.com/rust-lang/rust/issues/65490> for more information
--> src/lib.rs:WindowEvent {
event: Window