From: "Christoph Heiss" <c.heiss@proxmox.com>
To: "Michael Köppl" <m.koeppl@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-installer v3 6/7] tui: change get_value return type for easier error handling
Date: Mon, 07 Jul 2025 14:56:42 +0200 [thread overview]
Message-ID: <DB5U8MNO3XCU.2ANSDMCBELPYH@proxmox.com> (raw)
In-Reply-To: <20250626151119.255169-7-m.koeppl@proxmox.com>
On Thu Jun 26, 2025 at 5:11 PM CEST, Michael Köppl wrote:
[..]
> diff --git a/proxmox-tui-installer/src/views/mod.rs b/proxmox-tui-installer/src/views/mod.rs
> index 4364489..3211c93 100644
> --- a/proxmox-tui-installer/src/views/mod.rs
> +++ b/proxmox-tui-installer/src/views/mod.rs
> @@ -387,8 +387,8 @@ where
> }
> }
>
> -impl FormViewGetValue<CidrAddress> for CidrAddressEditView {
> - fn get_value(&self) -> Option<CidrAddress> {
> +impl FormViewGetValue<(IpAddr, usize)> for CidrAddressEditView {
> + fn get_value(&self) -> Option<(IpAddr, usize)> {
I see _why_ you changed it, although it's a bit backwards - since it
makes sense that `CidrAddressEditView` would produce a `CidrAddress`.
The proper solution here is to change `FormViewGetValue::get_value()` to
return a `Result<R>` instead of an `Option<R>`, such that errors can
easily be bubbled up.
IIRC I started a series locally to do exactly that and address these
cases, but it's a bigger refactoring.
But for now, IMHO this would be okay as a stop-gap solution, instead of
holding up this series on a somewhat unrelated refactoring.
Can you please at least add a big FIXME here, that this implementation
should use `CidrAddress` (again) instead of a (IP, mask) tuple?
> self.get_values()
> }
> }
> @@ -569,7 +569,7 @@ impl CidrAddressEditView {
> .fixed_width(4)
> }
>
> - fn get_values(&self) -> Option<CidrAddress> {
> + fn get_values(&self) -> Option<(IpAddr, usize)> {
> let addr = self
> .view
> .get_child(0)?
> @@ -587,7 +587,7 @@ impl CidrAddressEditView {
> .get_content()
> .ok()?;
>
> - CidrAddress::new(addr, mask).ok()
> + Some((addr, mask))
> }
> }
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-07-07 12:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 15:11 [pve-devel] [PATCH docs/installer v3 0/8] add early disk and network sanity checks Michael Köppl
2025-06-26 15:11 ` [pve-devel] [PATCH pve-installer v3 1/7] auto: add early answer file sanity check for RAID configurations Michael Köppl
2025-06-26 15:11 ` [pve-devel] [PATCH pve-installer v3 2/7] move RAID setup checks to RAID level enum implementations Michael Köppl
2025-07-07 11:47 ` Christoph Heiss
2025-07-08 12:01 ` Michael Köppl
2025-07-08 13:46 ` Christoph Heiss
2025-07-08 14:36 ` Michael Köppl
2025-06-26 15:11 ` [pve-devel] [PATCH pve-installer v3 3/7] close #5887: add sanity check for LVM swapsize Michael Köppl
2025-07-07 12:07 ` Christoph Heiss
2025-07-08 17:45 ` Michael Köppl
2025-06-26 15:11 ` [pve-devel] [PATCH pve-installer v3 4/7] auto: add check for duplicate disks in answer file Michael Köppl
2025-06-26 15:11 ` [pve-devel] [PATCH pve-installer v3 5/7] common: add more descriptive errors for invalid network configs Michael Köppl
2025-07-07 12:37 ` Christoph Heiss
2025-07-08 17:34 ` Michael Köppl
2025-06-26 15:11 ` [pve-devel] [PATCH pve-installer v3 6/7] tui: change get_value return type for easier error handling Michael Köppl
2025-07-07 12:56 ` Christoph Heiss [this message]
2025-06-26 15:11 ` [pve-devel] [PATCH pve-installer v3 7/7] common: add checks for valid subnet mask and IPv4 address within subnet Michael Köppl
2025-06-26 15:11 ` [pve-devel] [PATCH pve-docs v3 1/1] installation: remove maxroot size requirement and mention default instead Michael Köppl
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=DB5U8MNO3XCU.2ANSDMCBELPYH@proxmox.com \
--to=c.heiss@proxmox.com \
--cc=m.koeppl@proxmox.com \
--cc=pve-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox