Add Dynamic::from(&str)

This commit is contained in:
Stephen Chung
2020-10-06 21:25:05 +08:00
parent 1de44c7ecd
commit 8809d25d3c
3 changed files with 23 additions and 1 deletions

View File

@@ -572,6 +572,12 @@ impl Dynamic {
.clone()
.into();
}
if TypeId::of::<T>() == TypeId::of::<&str>() {
return <dyn Any>::downcast_ref::<&str>(&value)
.unwrap()
.to_string()
.into();
}
if TypeId::of::<T>() == TypeId::of::<()>() {
return ().into();
}