mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-07-31 03:51:56 +00:00
Work with #![no_std]
contexts
This commit adds support for both `#![no_std]` in the wasm-bindgen runtime support (disabled by default with an on-by-default `std` feature). This also adds support to work and compile in the context of `#![no_std]` crates. Closes #146
This commit is contained in:
@@ -72,7 +72,6 @@ simple! {
|
||||
f64 => F64
|
||||
bool => BOOLEAN
|
||||
str => STRING
|
||||
String => STRING
|
||||
JsValue => ANYREF
|
||||
}
|
||||
|
||||
@@ -105,16 +104,24 @@ impl<'a, T: WasmDescribe + ?Sized> WasmDescribe for &'a mut T {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: WasmDescribe> WasmDescribe for Box<[T]> {
|
||||
fn describe() {
|
||||
inform(VECTOR);
|
||||
T::describe();
|
||||
}
|
||||
}
|
||||
if_std! {
|
||||
use std::prelude::v1::*;
|
||||
|
||||
impl<T> WasmDescribe for Vec<T> where Box<[T]>: WasmDescribe {
|
||||
fn describe() {
|
||||
<Box<[T]>>::describe();
|
||||
impl WasmDescribe for String {
|
||||
fn describe() { inform(STRING) }
|
||||
}
|
||||
|
||||
impl<T: WasmDescribe> WasmDescribe for Box<[T]> {
|
||||
fn describe() {
|
||||
inform(VECTOR);
|
||||
T::describe();
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> WasmDescribe for Vec<T> where Box<[T]>: WasmDescribe {
|
||||
fn describe() {
|
||||
<Box<[T]>>::describe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user