From: Stefan Hanreich <s.hanreich@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>,
Proxmox Datacenter Manager development discussion
<pdm-devel@lists.proxmox.com>
Subject: Re: [pdm-devel] [PATCH proxmox-yew-widget-toolkit 1/1] data table: add get_property helper for displaying optional values
Date: Wed, 20 Aug 2025 12:46:11 +0200 [thread overview]
Message-ID: <467fb7cc-a03c-46d0-86f4-6cffdd7244ad@proxmox.com> (raw)
In-Reply-To: <e1704f72-da05-4ee9-86c6-a8fad6c1de16@proxmox.com>
On 8/20/25 12:33 PM, Dominik Csapak wrote:
[snip]
> if you have an Option<&str> you can omit the .as_deref()
> ```
> Some("foo").unwrap_or("")
> ```
>
> works
>
I have an Option<String>, where it doesn't work afaict (without cloning).
[snip]
>>>> {{get_property_fn(item).map(VNode::from).unwrap_or_default()}},
>>>
>>> mhmm since we require the Display trait as boundary, wouldn't a
>>> to_string() be better here? The default for VNode is a VList, but an
>>> empty string produces a VText
>>
>> this allocates a string for every cell, whereas VList doesn't and both
>> are effectively the same (no HTML produced)
>
> yes it does, VNode::from for T which impl ToString (implicitly by
> Display) uses to_string too:
>
> https://docs.rs/yew/latest/src/yew/virtual_dom/vnode.rs.html#164-166
Ah sorry, I though you were talking about the Default case. Nevertheless
it would still make sense to use the Yew provided implementation then?
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
prev parent reply other threads:[~2025-08-20 10:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 13:25 Stefan Hanreich
2025-08-20 9:13 ` Dominik Csapak
2025-08-20 10:29 ` Stefan Hanreich
2025-08-20 10:34 ` Dominik Csapak
2025-08-20 10:41 ` Dominik Csapak
2025-08-20 10:46 ` Stefan Hanreich [this message]
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=467fb7cc-a03c-46d0-86f4-6cffdd7244ad@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pdm-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