Enum nostr_types::NostrBech32
source · pub enum NostrBech32 {
EventAddr(EventAddr),
EventPointer(EventPointer),
Id(Id),
Profile(Profile),
Pubkey(PublicKey),
Relay(UncheckedUrl),
}
Expand description
A bech32 sequence representing a nostr object (or set of objects)
Variants§
EventAddr(EventAddr)
naddr - a NostrBech32 parameterized replaceable event coordinate
EventPointer(EventPointer)
nevent - a NostrBech32 representing an event and a set of relay URLs
Id(Id)
note - a NostrBech32 representing an event
Profile(Profile)
nprofile - a NostrBech32 representing a public key and a set of relay URLs
Pubkey(PublicKey)
npub - a NostrBech32 representing a public key
Relay(UncheckedUrl)
nrelay - a NostrBech32 representing a set of relay URLs
Implementations§
source§impl NostrBech32
impl NostrBech32
sourcepub fn new_pubkey(pubkey: PublicKey) -> NostrBech32
pub fn new_pubkey(pubkey: PublicKey) -> NostrBech32
Create from a PublicKey
sourcepub fn new_profile(profile: Profile) -> NostrBech32
pub fn new_profile(profile: Profile) -> NostrBech32
Create from a Profile
sourcepub fn new_id(id: Id) -> NostrBech32
pub fn new_id(id: Id) -> NostrBech32
Create from an Id
sourcepub fn new_event_pointer(ep: EventPointer) -> NostrBech32
pub fn new_event_pointer(ep: EventPointer) -> NostrBech32
Create from an EventPointer
sourcepub fn new_relay(url: UncheckedUrl) -> NostrBech32
pub fn new_relay(url: UncheckedUrl) -> NostrBech32
Create from an UncheckedUrl
sourcepub fn try_from_string(s: &str) -> Option<NostrBech32>
pub fn try_from_string(s: &str) -> Option<NostrBech32>
Try to convert a string into a NostrBech32. Must not have leading or trailing junk for this to work.
sourcepub fn find_all_in_string(s: &str) -> Vec<NostrBech32>
pub fn find_all_in_string(s: &str) -> Vec<NostrBech32>
Find all NostrBech32
s in a string, returned in the order found
Trait Implementations§
source§impl Clone for NostrBech32
impl Clone for NostrBech32
source§fn clone(&self) -> NostrBech32
fn clone(&self) -> NostrBech32
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for NostrBech32
impl Debug for NostrBech32
Auto Trait Implementations§
impl RefUnwindSafe for NostrBech32
impl Send for NostrBech32
impl Sync for NostrBech32
impl Unpin for NostrBech32
impl UnwindSafe for NostrBech32
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more