Idiomatic Implementation of reactive_stores::PatchField for non-primative types & enums?
              
              #3345
            
            -
| Hi, I've got  #[derive(Patch)]
struct Example {
    a: Option<String>,
}produces compiler error:  Digging into the  Rust (1.84.0-nightly) doesn't allow implementing external traits such as  impl<T> Patch for Option<T> { ... }
// nor this
impl Patch for Option<String> { ... } A common work around I've encountered to Rust's strictness r.e. external trait implementations is to wrap an external type in a new local type and implement the external trait for it. And indeed, this satisfies the compiler... #[derive(Patch)]
struct Example {
    a: Patchable<Option<String>>,
}
#[derive(PartialEq)]
struct Patchable<T>(T);
impl<T> PatchField for Pachable<T> where T: PartialEq { ... }Am I going about this the right way? My specific use-case requires  Is this the idiomatic way to implement  Cheers, | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
| This is definitely just a case of me publishing a fairly experimental crate without implementing the trait for all the types it really should be implemented for, not a case of you running into a skill issue! If you have a decent implementation of  Purely an issue of time constraints on my part. | 
Beta Was this translation helpful? Give feedback.
This is definitely just a case of me publishing a fairly experimental crate without implementing the trait for all the types it really should be implemented for, not a case of you running into a skill issue!
If you have a decent implementation of
PatchFieldforOption<_>types, a PR would be welcome. If not, maybe just a "feature request" kind of issue so I or someone else can come along and implement it?Purely an issue of time constraints on my part.