mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
implement wasm traits for roc_std::RocBox
This commit is contained in:
parent
b022175489
commit
625b9c161a
4 changed files with 27 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
use roc_std::{RocDec, RocList, RocOrder, RocResult, RocStr, I128, U128};
|
||||
use roc_std::{RocBox, RocDec, RocList, RocOrder, RocResult, RocStr, I128, U128};
|
||||
|
||||
pub trait Wasm32Sized: Sized {
|
||||
const SIZE_OF_WASM: usize;
|
||||
|
@ -45,6 +45,11 @@ impl<T: Wasm32Sized> Wasm32Sized for RocList<T> {
|
|||
const ALIGN_OF_WASM: usize = 4;
|
||||
}
|
||||
|
||||
impl<T: Wasm32Sized> Wasm32Sized for RocBox<T> {
|
||||
const SIZE_OF_WASM: usize = 4;
|
||||
const ALIGN_OF_WASM: usize = 4;
|
||||
}
|
||||
|
||||
impl<T: Wasm32Sized, E: Wasm32Sized> Wasm32Sized for RocResult<T, E> {
|
||||
const ALIGN_OF_WASM: usize = max(&[T::ALIGN_OF_WASM, E::ALIGN_OF_WASM]);
|
||||
const SIZE_OF_WASM: usize = max(&[T::ACTUAL_WIDTH, E::ACTUAL_WIDTH]) + 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue