Skip to content

Commit 792213b

Browse files
committed
mods
1 parent b172cf5 commit 792213b

File tree

3 files changed

+33
-27
lines changed

3 files changed

+33
-27
lines changed

src/wasm/src/lib.rs

+2-27
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,5 @@
11
#![no_std]
22

3-
extern crate alloc;
3+
mod mods;
44

5-
use alloc::vec::Vec;
6-
use wasm_bindgen::prelude::*;
7-
8-
#[wasm_bindgen]
9-
pub struct Memory {
10-
#[wasm_bindgen(skip)]
11-
pub inner: Vec<u8>,
12-
}
13-
14-
#[wasm_bindgen]
15-
impl Memory {
16-
#[wasm_bindgen(constructor)]
17-
pub fn new(inner: Vec<u8>) -> Memory {
18-
Memory { inner }
19-
}
20-
21-
#[wasm_bindgen]
22-
pub fn ptr(&self) -> *const u8 {
23-
self.inner.as_ptr()
24-
}
25-
26-
#[wasm_bindgen]
27-
pub fn len(&self) -> usize {
28-
self.inner.len()
29-
}
30-
}
5+
pub use mods::*;

src/wasm/src/mods/memory/mod.rs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
extern crate alloc;
2+
3+
use alloc::vec::Vec;
4+
use wasm_bindgen::prelude::*;
5+
6+
#[wasm_bindgen]
7+
pub struct Memory {
8+
#[wasm_bindgen(skip)]
9+
pub inner: Vec<u8>,
10+
}
11+
12+
#[wasm_bindgen]
13+
impl Memory {
14+
#[wasm_bindgen(constructor)]
15+
pub fn new(inner: Vec<u8>) -> Memory {
16+
Memory { inner }
17+
}
18+
19+
#[wasm_bindgen]
20+
pub fn ptr(&self) -> *const u8 {
21+
self.inner.as_ptr()
22+
}
23+
24+
#[wasm_bindgen]
25+
pub fn len(&self) -> usize {
26+
self.inner.len()
27+
}
28+
}

src/wasm/src/mods/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mod memory;
2+
3+
pub use memory::*;

0 commit comments

Comments
 (0)