Merge pull request #1490 from RReverser/deprecate-custom-try-from

Recommend to use dyn_ref on funcs and strings
This commit is contained in:
Alex Crichton 2019-04-29 09:08:00 -05:00 committed by GitHub
commit 60bb68649b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1089,6 +1089,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()
}
@ -3819,6 +3820,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()
}