From: Shannon Sterz <s.sterz@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [yew-devel] [PATCH yew-comp 1/3] tree wide: switch from `Into` to `From` implementations where possible
Date: Tue, 14 Jan 2025 10:09:38 +0100 [thread overview]
Message-ID: <20250114090940.29366-1-s.sterz@proxmox.com> (raw)
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
next reply other threads:[~2025-01-14 9:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-14 9:09 Shannon Sterz [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250114090940.29366-1-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=yew-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.