@effindomv2/fui-rs 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +1 -1
- package/package.json +1 -1
- package/src/lib.rs +20 -1
package/Cargo.toml
CHANGED
package/package.json
CHANGED
package/src/lib.rs
CHANGED
|
@@ -317,13 +317,22 @@ macro_rules! ui {
|
|
|
317
317
|
#[macro_export]
|
|
318
318
|
macro_rules! fui_component {
|
|
319
319
|
($component:ty => $root:ident) => {
|
|
320
|
+
$crate::fui_component!(@impl $component => $root, [root]);
|
|
321
|
+
};
|
|
322
|
+
($component:ty => $root:ident, owner: $owner:ident) => {
|
|
323
|
+
$crate::fui_component!(@impl $component => $root, [owner $owner]);
|
|
324
|
+
};
|
|
325
|
+
($component:ty => $root:ident, owners: [$($owner:ident),+ $(,)?]) => {
|
|
326
|
+
$crate::fui_component!(@impl $component => $root, [owners $($owner),+]);
|
|
327
|
+
};
|
|
328
|
+
(@impl $component:ty => $root:ident, $owner_spec:tt) => {
|
|
320
329
|
impl $crate::Node for $component {
|
|
321
330
|
fn retained_node_ref(&self) -> $crate::node::NodeRef {
|
|
322
331
|
$crate::Node::retained_node_ref(&self.$root)
|
|
323
332
|
}
|
|
324
333
|
|
|
325
334
|
fn retained_owner_attachment(&self) -> Option<std::rc::Rc<dyn std::any::Any>> {
|
|
326
|
-
$crate::
|
|
335
|
+
$crate::fui_component!(@owner_attachment self, $root, $owner_spec)
|
|
327
336
|
}
|
|
328
337
|
|
|
329
338
|
fn build_self(&self) {
|
|
@@ -337,6 +346,16 @@ macro_rules! fui_component {
|
|
|
337
346
|
}
|
|
338
347
|
}
|
|
339
348
|
};
|
|
349
|
+
(@owner_attachment $this:ident, $root:ident, [root]) => {
|
|
350
|
+
$crate::Node::retained_owner_attachment(&$this.$root)
|
|
351
|
+
};
|
|
352
|
+
(@owner_attachment $this:ident, $root:ident, [owner $owner:ident]) => {{
|
|
353
|
+
let owner: std::rc::Rc<dyn std::any::Any> = $this.$owner.clone();
|
|
354
|
+
Some(owner)
|
|
355
|
+
}};
|
|
356
|
+
(@owner_attachment $this:ident, $root:ident, [owners $($owner:ident),+]) => {
|
|
357
|
+
Some(std::rc::Rc::new(($($this.$owner.clone(),)+)))
|
|
358
|
+
};
|
|
340
359
|
}
|
|
341
360
|
|
|
342
361
|
pub mod prelude {
|