소스 검색

Merge pull request #1651 from ealmloff/string-into-attribute

Add into attribute value impl for String
Jonathan Kelley 1 년 전
부모
커밋
850f2da0c6
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      packages/core/src/nodes.rs

+ 6 - 0
packages/core/src/nodes.rs

@@ -791,6 +791,12 @@ impl<'a> IntoAttributeValue<'a> for &'a str {
     }
 }
 
+impl<'a> IntoAttributeValue<'a> for String {
+    fn into_value(self, cx: &'a Bump) -> AttributeValue<'a> {
+        AttributeValue::Text(cx.alloc_str(&self))
+    }
+}
+
 impl<'a> IntoAttributeValue<'a> for f64 {
     fn into_value(self, _: &'a Bump) -> AttributeValue<'a> {
         AttributeValue::Float(self)