我可以通过运行emcc -O3 -s WASM=1 -s SIDE_MODULE=1 -o sum.wasm sum.c从以下C代码生成相当小的(203字节)wasm文件。 #include <emscripten/emscripten.h>
int EMSCRIPTEN_KEEPALIVE sum(int a, int b) {
return a + b;
}
拆输出: (m
struct A;
impl A {
fn foo(&mut self) {}
}
fn main() {
let mut a = A;
let x = &{ &mut a };
x.foo();
}
error[E0389]: cannot borrow data mutably in a `&` reference
--> src/mai
阅读防锈教程中,我发现下面的代码片段: let f = File::open("hello.txt");
let mut f = match f {
Ok(file) => file,
Err(e) => return Err(e)
};
这似乎是f可以有Result<_, _>类型的值(如果f == Err(e))或_类型的值(即,无论何种类型file恰好是)。 那