Repository: arrayfire/arrayfire-rust (language: rust)

Issue:
[Build] Half 2.2.0 is not compatible
Description
===========
The latest version of half 2.2.0 is not compatible with arrayfire-rust 3.8.0


Build Environment
-----------------
Compiler version: <!-- MSVC v140 or gcc 9.3.2 -->
Operating system: <!-- Windows 10; Ubuntu 18.04 -->
Build environment: <!-- Environment variables; Installed software -->

Error Log
---------

```
use half;
use half::f16;
use half::*;
fn main() {

	let arr = vec![half::f16::from_f32(5.4), half::f16::from_f32(-2.1),half::f16::from_f32(-2.1)  ];

	let mut test = arrayfire::Array::new(&arr, arrayfire::Dim4::new(&[3, 1, 1, 1]));

}
```





error[E0277]: the trait bound `f16: HasAfEnum` is not satisfied
   --> examples/test.rs:27:17
    |
27  |     let mut test = arrayfire::Array::new(&arr, arrayfire::Dim4::new(&[3, 1, 1, 1]));
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasAfEnum` is not implemented for `f16`
    |
    = help: the following other types implement trait `HasAfEnum`:
              bool
              f32
              f64
              half::binary16::f16
              i16
              i32
              i64
              num_complex::Complex<f32>
            and 5 others
note: required by a bound in `Array`
   --> /home/test/.cargo/registry/src/github.com-1ecc6299db9ec823/arrayfire-3.8.0/src/core/array.rs:163:21
    |
163 | pub struct Array<T: HasAfEnum> {
    |                     ^^^^^^^^^ required by this bound in `Array`



Discussion / hints:
Updating half to 2.2.0 in the arrayfire-rust Cargo.toml fixes this

I need from_f32_const and from_f64_const  from the newer half versions



@BA8F0D39 Would it be possible for you to submit a PR ? That would be great.

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index 97553800..4c10f777 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -52,11 +52,11 @@ afserde = ["serde"]
 libc = "0.2"
 num  = "0.4.0"
 lazy_static = "1.0"
-half = "1.5.0"
+half = { version = "2.2.1" , features = ["num-traits"] }
 serde = { version = "1.0", features = ["derive"], optional = true }
 
 [dev-dependencies]
-half = "1.5.0"
+half = { version = "2.2.1" , features = ["num-traits"] }
 serde_json = "1.0"
 bincode = "1.3"
 mnist = {version="0.5.0", features = ["download"]}


Test patch: