浏览代码

Feat: Make AttributeValue::Any usable (#565)

* Implemented Display for AttributeValue::Any

* Make ArbitraryAttributeValue public

* allow(missing_docs) for ArbitraryAttributeValue

* Formatted lib.rs
Marc Espín 2 年之前
父节点
当前提交
964a942243
共有 2 个文件被更改,包括 7 次插入5 次删除
  1. 2 1
      packages/core/src/arbitrary_value.rs
  2. 5 4
      packages/core/src/lib.rs

+ 2 - 1
packages/core/src/arbitrary_value.rs

@@ -66,12 +66,13 @@ impl<'a> std::fmt::Display for AttributeValue<'a> {
             AttributeValue::Vec4Int(_, _, _, _) => todo!(),
             AttributeValue::Vec4Uint(_, _, _, _) => todo!(),
             AttributeValue::Bytes(a) => write!(f, "{:?}", a),
-            AttributeValue::Any(_) => todo!(),
+            AttributeValue::Any(a) => write!(f, "{:?}", a),
         }
     }
 }
 
 #[derive(Clone, Copy)]
+#[allow(missing_docs)]
 pub struct ArbitraryAttributeValue<'a> {
     pub value: &'a dyn std::any::Any,
     pub cmp: fn(&'a dyn std::any::Any, &'a dyn std::any::Any) -> bool,

+ 5 - 4
packages/core/src/lib.rs

@@ -63,10 +63,11 @@ pub(crate) mod innerlude {
 }
 
 pub use crate::innerlude::{
-    AnyEvent, Attribute, AttributeValue, Component, DioxusElement, DomEdit, Element, ElementId,
-    ElementIdIterator, EventHandler, EventPriority, IntoVNode, LazyNodes, Listener, Mutations,
-    NodeFactory, Properties, SchedulerMsg, Scope, ScopeId, ScopeState, TaskId, UiEvent, UserEvent,
-    VComponent, VElement, VFragment, VNode, VPlaceholder, VText, VirtualDom,
+    AnyEvent, ArbitraryAttributeValue, Attribute, AttributeValue, Component, DioxusElement,
+    DomEdit, Element, ElementId, ElementIdIterator, EventHandler, EventPriority, IntoVNode,
+    LazyNodes, Listener, Mutations, NodeFactory, Properties, SchedulerMsg, Scope, ScopeId,
+    ScopeState, TaskId, UiEvent, UserEvent, VComponent, VElement, VFragment, VNode, VPlaceholder,
+    VText, VirtualDom,
 };
 
 /// The purpose of this module is to alleviate imports of many common types