Comments (5)
Maybe the best way is to impl Eq
and PartialEq
manually checking if the u64
kind number is equal.
In this way Kind::Custom(20100)
will be equal to Kind::Ephemeral(20100)
.
What do you think?
from nostr.
Something like:
impl PartialEq<Kind> for Kind {
fn eq(&self, other: &Kind) -> bool {
self.as_u64() == other.as_u64()
}
}
from nostr.
Sounds promising.
from nostr.
Now I have the doubt to have misunderstood what you mean.
Have I?
I don't think that can be enforced the use of Kind::from(...)
.
Using the solution that I applied, if someone used Kind::Custom instead Kind::Ephemeral everything works (I added ephemeral kind not long ago). In this way it's backwards compatible.
from nostr.
Tested the new version, works! Thanks.
You're right, your idea with PartialEq
is even better than enforcing Kind::from(...)
. Especially cause it's backwards compatible.
from nostr.
Related Issues (20)
- direct post to other platforms HOT 2
- Allow sharing RelayPool beetween client instances HOT 1
- Duplicate Display name causes json error HOT 1
- `Client::send_event()` returns `Ok` even when event not sent HOT 2
- Possible to track relay latency? HOT 4
- `Client.get_events_of()` bug HOT 2
- Add `get_events_of` variant for post-`EOSE` events HOT 6
- Add Sign PSBT method to NIP 46
- Add WASM support for `nostr-sdk` HOT 2
- Complete NIP46 integration into `nostr-sdk`
- JsonDeserializationFailed on negative numbers HOT 1
- Nip 12 generic tags support HOT 1
- NIP57 Support HOT 1
- Tag for generated Event seems to be missing # symbol HOT 1
- Allow `handle_notifications` in mod.rs to accept an async closure HOT 1
- Filter `authors` not conforming to NIP-01
- NIP19 data types should have all fields accessible
- Restore Pow message publishing HOT 2
- Relay pool shutdown() forces sleep? HOT 6
- Parsing and serializing `relay` tag kind appends a slash and that breaks signature HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nostr.