From ccc99cd047a223a1ed6bb5562a2cf596393ec98e Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Fri, 26 Apr 2019 15:50:08 +0100 Subject: [PATCH] Recommend to use dyn_ref on funcs and strings Now that functions and strings work properly with custom typechecks, these custom methods seem obsolete, so I'd recommend to use standard dyn_ref instead. --- crates/js-sys/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 952da3edc02..6d1bc28d6db 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -1078,6 +1078,7 @@ impl Function { /// /// If this JS value is not an instance of a function then this returns /// `None`. + #[deprecated(note = "recommended to use dyn_ref instead which is now equivalent")] pub fn try_from(val: &JsValue) -> Option<&Function> { val.dyn_ref() } @@ -3796,6 +3797,7 @@ impl JsString { /// /// If this JS value is not an instance of a string then this returns /// `None`. + #[deprecated(note = "recommended to use dyn_ref instead which is now equivalent")] pub fn try_from(val: &JsValue) -> Option<&JsString> { val.dyn_ref() }