all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [yew-devel] [PATCH yew-comp 1/3] tree wide: switch from `Into` to `From` implementations where possible
@ 2025-01-14  9:09 Shannon Sterz
  2025-01-14  9:09 ` [yew-devel] [PATCH yew-comp 2/3] tree wide: implement `Default` for `new()` functions without parameter Shannon Sterz
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Shannon Sterz @ 2025-01-14  9:09 UTC (permalink / raw)
  To: yew-devel

this is more flexible as a `From` implementation gives us an `Into`
implementation for free. fixes the clippy ling `from_over_into` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 src/configuration/network_edit.rs | 6 +++---
 src/configuration/network_view.rs | 6 +++---
 src/rrd_graph_new.rs              | 6 +++---
 src/rrd_timeframe_selector.rs     | 6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/configuration/network_edit.rs b/src/configuration/network_edit.rs
index 84a9380..b97b86a 100644
--- a/src/configuration/network_edit.rs
+++ b/src/configuration/network_edit.rs
@@ -369,9 +369,9 @@ impl Component for ProxmoxNetworkEdit {
     }
 }
 
-impl Into<VNode> for NetworkEdit {
-    fn into(self) -> VNode {
-        let comp = VComp::new::<ProxmoxNetworkEdit>(Rc::new(self), None);
+impl From<NetworkEdit> for VNode {
+    fn from(val: NetworkEdit) -> Self {
+        let comp = VComp::new::<ProxmoxNetworkEdit>(Rc::new(val), None);
         VNode::from(comp)
     }
 }
diff --git a/src/configuration/network_view.rs b/src/configuration/network_view.rs
index cc2faae..fa9f985 100644
--- a/src/configuration/network_view.rs
+++ b/src/configuration/network_view.rs
@@ -319,9 +319,9 @@ impl LoadableComponent for ProxmoxNetworkView {
     }
 }
 
-impl Into<VNode> for NetworkView {
-    fn into(self) -> VNode {
-        let comp = VComp::new::<LoadableComponentMaster<ProxmoxNetworkView>>(Rc::new(self), None);
+impl From<NetworkView> for VNode {
+    fn from(val: NetworkView) -> Self {
+        let comp = VComp::new::<LoadableComponentMaster<ProxmoxNetworkView>>(Rc::new(val), None);
         VNode::from(comp)
     }
 }
diff --git a/src/rrd_graph_new.rs b/src/rrd_graph_new.rs
index 21890a1..2c77a38 100644
--- a/src/rrd_graph_new.rs
+++ b/src/rrd_graph_new.rs
@@ -1030,9 +1030,9 @@ impl Component for PwtRRDGraph {
     }
 }
 
-impl Into<VNode> for RRDGraph {
-    fn into(self) -> VNode {
-        let comp = VComp::new::<PwtRRDGraph>(Rc::new(self), None);
+impl From<RRDGraph> for VNode {
+    fn from(val: RRDGraph) -> Self {
+        let comp = VComp::new::<PwtRRDGraph>(Rc::new(val), None);
         VNode::from(comp)
     }
 }
diff --git a/src/rrd_timeframe_selector.rs b/src/rrd_timeframe_selector.rs
index a027046..d674f7c 100644
--- a/src/rrd_timeframe_selector.rs
+++ b/src/rrd_timeframe_selector.rs
@@ -233,9 +233,9 @@ impl Component for PwtRRDTimeframeSelector {
     }
 }
 
-impl Into<VNode> for RRDTimeframeSelector {
-    fn into(self) -> VNode {
-        let comp = VComp::new::<PwtRRDTimeframeSelector>(Rc::new(self), None);
+impl From<RRDTimeframeSelector> for VNode {
+    fn from(val: RRDTimeframeSelector) -> Self {
+        let comp = VComp::new::<PwtRRDTimeframeSelector>(Rc::new(val), None);
         VNode::from(comp)
     }
 }
-- 
2.39.5



_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-14  9:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-14  9:09 [yew-devel] [PATCH yew-comp 1/3] tree wide: switch from `Into` to `From` implementations where possible Shannon Sterz
2025-01-14  9:09 ` [yew-devel] [PATCH yew-comp 2/3] tree wide: implement `Default` for `new()` functions without parameter Shannon Sterz
2025-01-14  9:24   ` [yew-devel] applied: " Dietmar Maurer
2025-01-14  9:09 ` [yew-devel] [PATCH yew-comp 3/3] apt package manager: use a `Box` for `Package` enum variant Shannon Sterz
2025-01-14  9:24   ` [yew-devel] applied: " Dietmar Maurer
2025-01-14  9:22 ` [yew-devel] applied: [PATCH yew-comp 1/3] tree wide: switch from `Into` to `From` implementations where possible Dietmar Maurer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal