Skip to content

Commit ccc99cd

Browse files
committed
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.
1 parent 26f9d86 commit ccc99cd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/js-sys/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,7 @@ impl Function {
10781078
///
10791079
/// If this JS value is not an instance of a function then this returns
10801080
/// `None`.
1081+
#[deprecated(note = "recommended to use dyn_ref instead which is now equivalent")]
10811082
pub fn try_from(val: &JsValue) -> Option<&Function> {
10821083
val.dyn_ref()
10831084
}
@@ -3796,6 +3797,7 @@ impl JsString {
37963797
///
37973798
/// If this JS value is not an instance of a string then this returns
37983799
/// `None`.
3800+
#[deprecated(note = "recommended to use dyn_ref instead which is now equivalent")]
37993801
pub fn try_from(val: &JsValue) -> Option<&JsString> {
38003802
val.dyn_ref()
38013803
}

0 commit comments

Comments
 (0)