Replace val_to_string with to_string (via fmt::Display)

This commit is contained in:
Andrew Morris
2023-05-26 13:17:31 +10:00
parent 3cfe1a6527
commit bc89575eae
24 changed files with 217 additions and 167 deletions

View File

@@ -1,3 +1,4 @@
use std::fmt;
use std::rc::Rc;
use num_bigint::BigInt;
@@ -18,9 +19,6 @@ impl ValTrait for NativeFrameFunction {
fn typeof_(&self) -> VsType {
VsType::Function
}
fn val_to_string(&self) -> String {
"function() { [native code] }".to_string()
}
fn to_number(&self) -> f64 {
f64::NAN
}
@@ -81,3 +79,9 @@ impl ValTrait for NativeFrameFunction {
"function() { [native code] }".into()
}
}
impl fmt::Display for NativeFrameFunction {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "function() {{ [native code] }}")
}
}