nostr: tags rework#1347
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1347 +/- ##
==========================================
+ Coverage 70.71% 70.89% +0.18%
==========================================
Files 190 201 +11
Lines 31850 33366 +1516
==========================================
+ Hits 22522 23656 +1134
- Misses 9328 9710 +382
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
46c6413 to
ac6699c
Compare
|
I'll not point to those syntax change more :) |
TheAwiteb
left a comment
There was a problem hiding this comment.
Most of nip22 code is a copy from nip01, I'm not sure why you did it like this
- Remove `Tag::from_standardized_without_cell` - Remove `Tag::to_standardized` and `Tag::as_standardized` and add `Tag::standardized` - Update all the related code Ref nostrdevkit#907 Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
|
@TheAwiteb, I've marked your comments as resolved but I not pushed yet the updates. I'm doing one last refactor, I'll push soon the last changes |
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Closes nostrdevkit#1204 Closes nostrdevkit#1216 Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Closes nostrdevkit#907 Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
TheAwiteb
left a comment
There was a problem hiding this comment.
Cool, but I don't like this if statement everywhere in nip22
if *uppercase {
tag[0] = String::from("A");
}What do you think about something like this?
#[inline]
fn maybe_uppercase(mut tag: Tag, uppercase: bool) -> Tag {
if uppercase {
tag[0] = tag[0].to_ascii_uppercase();
}
tag
}So you can use it like this
maybe_uppercase(nip01::serialize_a_tag(coordinate, relay_hint.as_ref()), uppercase)It's fast btw, here is its code from the std
pub const fn is_ascii_lowercase(&self) -> bool {
matches!(*self, b'a'..=b'z')
}
pub const fn to_ascii_uppercase(&self) -> u8 {
// Toggle the 6th bit if this is a lowercase letter
*self ^ ((self.is_ascii_lowercase() as u8) * ASCII_CASE_MASK)
}|
Thanks, updated at 6eb0321 |
Co-authored-by: Awiteb <a@4rs.nl> Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Description
Remove
TagStandardandTagKindin favor of per-NIP tag enums.Closes #907
Closes #1204
Closes #1216
Closes #1320
Replaces #1321
Checklist