mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed tests on WIndows due to target arch wasm32
This commit is contained in:
parent
109a76e1b3
commit
19eb7d1814
@ -7,17 +7,21 @@ pub use plugin_derive::*;
|
|||||||
|
|
||||||
use serde::{de::DeserializeOwned, Serialize};
|
use serde::{de::DeserializeOwned, Serialize};
|
||||||
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn raw_emit_actions(ptr: *const u8, len: usize);
|
fn raw_emit_actions(ptr: *const u8, len: usize);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn emit_action(action: api::Action) { emit_actions(vec![action]) }
|
pub fn emit_action(action: api::Action) { emit_actions(vec![action]) }
|
||||||
|
|
||||||
pub fn emit_actions(actions: Vec<api::Action>) {
|
pub fn emit_actions(_actions: Vec<api::Action>) {
|
||||||
let ret = bincode::serialize(&actions).expect("Can't serialize action in emit");
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
{
|
||||||
|
let ret = bincode::serialize(&_actions).expect("Can't serialize action in emit");
|
||||||
unsafe {
|
unsafe {
|
||||||
raw_emit_actions(ret.as_ptr(), ret.len());
|
raw_emit_actions(ret.as_ptr(), ret.len());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_input<T>(ptr: i32, len: u32) -> Result<T, &'static str>
|
pub fn read_input<T>(ptr: i32, len: u32) -> Result<T, &'static str>
|
||||||
|
Loading…
Reference in New Issue
Block a user