commit 7d20f3bcc2dada804a5724dc23b20ac00a7cd38c
parent 91d61b7ec3c46b9769f0562810f1f6bfd8a78b08
Author: William Casarin <jb55@jb55.com>
Date: Thu, 6 Jul 2023 22:10:44 -0700
shard: update mention type
We want to be able to parse different mention types. Let's update our
mention shard accordingly.
We make sure not to parse the bech32 at the point to be as lazy as
possible.
Diffstat:
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/shard.rs b/src/shard.rs
@@ -35,11 +35,21 @@ impl ByteSlice {
}
}
+/// A nostr mention: nostr:bech32... #[0]... etc
+#[derive(Debug, PartialEq, Eq)]
+pub enum Mention {
+ /// A tag mention #[1], etc
+ Index(u16),
+ /// A nostr: mention, starting from the start of the bech32 string to
+ /// the end It is not parsed at this point to keep things lazy and quick
+ Bech32(ByteSlice),
+}
+
/// A Shard represents a part of the shattered content.
#[derive(Debug, PartialEq, Eq)]
pub enum Shard {
Text(ByteSlice),
- Mention(ByteSlice),
+ Mention(Mention),
Hashtag(ByteSlice),
Url(ByteSlice),
//Invoice(Invoice)