diff options
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/lib.rs | 20 |
2 files changed, 15 insertions, 6 deletions
@@ -5,4 +5,3 @@ authors = ["Yuval Adam <_@yuv.al>"] edition = "2018" [dependencies] -bchlib-sys = "0.1.0" @@ -1,8 +1,17 @@ -extern crate bchlib_sys as ffi; -pub fn init(m:i32, t:i32, poly: u32) { - unsafe { - let bch = ffi::init_bch(m, t, poly); +pub struct BCH { + n: u32, +} + +impl BCH { + pub fn new(n: u32) -> BCH { + BCH { + n + } + } + + pub fn decode(self) -> u32{ + return self.n } } @@ -12,6 +21,7 @@ mod tests { #[test] fn it_works() { - init(); + let bch = BCH::new(3); + assert_eq!(bch.decode(), 3); } } |
