Support Wasi as target (#216)

* Improve features
* Add wasm32-wasi as a target
* Update .github/workflows/ci.yml
Co-authored-by: morenol <22335041+morenol@users.noreply.github.com>
This commit is contained in:
Lorenzo
2022-11-02 15:22:38 +00:00
committed by morenol
parent 7f35dc54e4
commit c45bab491a
64 changed files with 583 additions and 150 deletions
+4 -1
View File
@@ -76,7 +76,10 @@ impl<T: Number, A: ArrayView1<T>> Distance<A> for Euclidian<T> {
mod tests {
use super::*;
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(
all(target_arch = "wasm32", not(target_os = "wasi")),
wasm_bindgen_test::wasm_bindgen_test
)]
#[test]
fn squared_distance() {
let a = vec![1, 2, 3];
+4 -1
View File
@@ -70,7 +70,10 @@ impl<T: Number, A: ArrayView1<T>> Distance<A> for Hamming<T> {
mod tests {
use super::*;
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(
all(target_arch = "wasm32", not(target_os = "wasi")),
wasm_bindgen_test::wasm_bindgen_test
)]
#[test]
fn hamming_distance() {
let a = vec![1, 0, 0, 1, 0, 0, 1];
+4 -1
View File
@@ -139,7 +139,10 @@ mod tests {
use crate::linalg::basic::arrays::ArrayView2;
use crate::linalg::basic::matrix::DenseMatrix;
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(
all(target_arch = "wasm32", not(target_os = "wasi")),
wasm_bindgen_test::wasm_bindgen_test
)]
#[test]
fn mahalanobis_distance() {
let data = DenseMatrix::from_2d_array(&[
+4 -1
View File
@@ -66,7 +66,10 @@ impl<T: Number, A: ArrayView1<T>> Distance<A> for Manhattan<T> {
mod tests {
use super::*;
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(
all(target_arch = "wasm32", not(target_os = "wasi")),
wasm_bindgen_test::wasm_bindgen_test
)]
#[test]
fn manhattan_distance() {
let a = vec![1., 2., 3.];
+4 -1
View File
@@ -71,7 +71,10 @@ impl<T: Number, A: ArrayView1<T>> Distance<A> for Minkowski<T> {
mod tests {
use super::*;
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(
all(target_arch = "wasm32", not(target_os = "wasi")),
wasm_bindgen_test::wasm_bindgen_test
)]
#[test]
fn minkowski_distance() {
let a = vec![1., 2., 3.];