Files
wasmtime/wasmtime-api/src/trap.rs
Dan Gohman 8e1b44b29c Make more code work with no_std. (#407)
* Make more code work with no_std.

no_std support is still incomplete, but this patch takes care of the
bulk of the straightforward parts.
2019-10-08 16:53:32 -07:00

22 lines
366 B
Rust

use alloc::string::{String, ToString};
#[derive(Fail, Debug)]
#[fail(display = "Wasm trap")]
pub struct Trap {
message: String,
}
impl Trap {
pub fn new(message: String) -> Trap {
Trap { message }
}
pub fn fake() -> Trap {
Trap::new("TODO trap".to_string())
}
pub fn message(&self) -> &str {
&self.message
}
}