diff --git a/src/lib/js/value.rs b/src/lib/js/value.rs index 250d533fcc..44e722a5d5 100644 --- a/src/lib/js/value.rs +++ b/src/lib/js/value.rs @@ -626,6 +626,17 @@ impl FromValue for i32 { } } +impl ToValue for usize { + fn to_value(&self) -> Value { + Gc::new(ValueData::Integer(*self as i32)) + } +} +impl FromValue for usize { + fn from_value(v: Value) -> Result { + Ok(v.to_int() as usize) + } +} + impl ToValue for bool { fn to_value(&self) -> Value { Gc::new(ValueData::Boolean(*self))