From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D3A3B1FF179 for ; Wed, 29 Oct 2025 14:29:37 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 57440ADFD; Wed, 29 Oct 2025 14:30:11 +0100 (CET) From: Shannon Sterz To: yew-devel@lists.proxmox.com Date: Wed, 29 Oct 2025 14:30:00 +0100 Message-ID: <20251029133002.236835-1-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1761744592429 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.061 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [yew-devel] [RFC yew-comp/yew-widget-toolkit 0/2] add helpers to get a record via a Selection from a Store X-BeenThere: yew-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Yew framework devel list at Proxmox List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Yew framework devel list at Proxmox Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: yew-devel-bounces@lists.proxmox.com Sender: "yew-devel" a very common pattern is to use a `Store` combined with a `Selection`. however, to get the record from a `Store` that has the same `Key` as is selected by the `Selection` is a little cumbersome as it requires dealing with several optional values. so many components implement a helper for that. it usually looks like this: ```rust fn get_selected_record(&self) -> Option { self.selection .selected_key() .and_then(|key| self.store.read().lookup_record(&key).cloned()) } let Some(record) = self.get_selected_record() else { return false; } ``` to avoid duplicating this effort in every such component add new helper methods to the `Store`. they each take a `Selection` and either return an optional reference or an optional clone of the selected record. turning the above into: ```rust let Some(record) = self.store.selected_record(&self.selection) else { return false; } ``` the second commit in this series is mostly for demonstrative purposes. sending this as an rfc as i am not sure if the naming of these functions is ideal or whether we want to add both helpers (instead of just one of them). proxmox-yew-widget-toolkit: Shannon Sterz (1): store: add helper methods to extract a record via a selection src/state/store.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) proxmox-yew-comp: Shannon Sterz (1): token panel: use new `selected_record` helper src/token_panel.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) Summary over all repositories: 2 files changed, 19 insertions(+), 10 deletions(-) -- Generated by git-murpp 0.8.1 _______________________________________________ yew-devel mailing list yew-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel