[pdm-devel] [PATCH yew-comp 1/1] status: implement PartialEq and Clone for Status

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Apr 15 14:57:10 CEST 2025


On Tue, Apr 15, 2025 at 01:52:22PM +0200, Dominik Csapak wrote:
> On 4/14/25 16:50, Wolfgang Bumiller wrote:
> > On Fri, Apr 11, 2025 at 04:05:17PM +0200, Dominik Csapak wrote:
> > > this is sensible to have, e.g. when we want to have the status structs
> > > as parto of a type for a store
> > 
> > I'd argue these should all be:
> > 
> >      #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
> > 
> 
> sure, makes sense.
> 
> is a follow up enough or should I resend the patch ( or whole series?)

Either way is fine. I'd hold off on the pdm patches until after the bump
of yew-comp, to avoid it being in a non-buildable state too long.

We could derive more standard traits in a few more places probably, eg:
src/status.rs: Status, NodeState, GuestState, StorageState
src/common_api_types.rs: TaskStatusClass (misses Debug+Eq+Hash)
src/proxmox_product.rs: ExistingProduct (only misses Eq+Hash)
src/journal_view.rs: Position (only misses Eq+Hash)

> 
> > > 
> > > Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> > > ---
> > >   src/status.rs | 4 ++++
> > >   1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/src/status.rs b/src/status.rs
> > > index 9d951c5..ab77a15 100644
> > > --- a/src/status.rs
> > > +++ b/src/status.rs
> > > @@ -7,6 +7,7 @@ use pwt::{
> > >   /// Used to represent a Status of some resource or component, e.g.
> > >   /// if a PVE node is online or not.
> > > +#[derive(PartialEq, Clone)]
> > >   pub enum Status {
> > >       Success,
> > >       Warning,
> > > @@ -27,6 +28,7 @@ impl Status {
> > >   }
> > >   /// Used to represent the state of a Node, being PVE or PBS
> > > +#[derive(PartialEq, Clone)]
> > >   pub enum NodeState {
> > >       Online,
> > >       Offline,
> > > @@ -45,6 +47,7 @@ impl NodeState {
> > >   }
> > >   /// Used to represent the state of a PVE guest, such as a VM
> > > +#[derive(PartialEq, Clone)]
> > >   pub enum GuestState {
> > >       Running,
> > >       Paused,
> > > @@ -67,6 +70,7 @@ impl GuestState {
> > >   }
> > >   /// Used to represent the state of a Storage or Datastore
> > > +#[derive(PartialEq, Clone)]
> > >   pub enum StorageState {
> > >       Available,
> > >       Unavailable,
> > > -- 
> > > 2.39.5
> 
> 




More information about the pdm-devel mailing list