Skip to content

Commit 60bb686

Browse files
authored
Merge pull request #1490 from RReverser/deprecate-custom-try-from
Recommend to use dyn_ref on funcs and strings
2 parents 36c0a13 + ccc99cd commit 60bb686

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
@@ -1089,6 +1089,7 @@ impl Function {
10891089
///
10901090
/// If this JS value is not an instance of a function then this returns
10911091
/// `None`.
1092+
#[deprecated(note = "recommended to use dyn_ref instead which is now equivalent")]
10921093
pub fn try_from(val: &JsValue) -> Option<&Function> {
10931094
val.dyn_ref()
10941095
}
@@ -3819,6 +3820,7 @@ impl JsString {
38193820
///
38203821
/// If this JS value is not an instance of a string then this returns
38213822
/// `None`.
3823+
#[deprecated(note = "recommended to use dyn_ref instead which is now equivalent")]
38223824
pub fn try_from(val: &JsValue) -> Option<&JsString> {
38233825
val.dyn_ref()
38243826
}

0 commit comments

Comments
 (0)