pub struct Nip17TextMessage { /* private fields */ }Expand description
A validated one-to-one kind-14 text-message rumor.
This first profile intentionally does not assign typed semantics to reply, subject, forwarding, media, or group tags. Exact unknown tags remain on the underlying rumor and therefore remain part of its event ID.
Implementations§
Source§impl Nip17TextMessage
impl Nip17TextMessage
Sourcepub fn from_rumor(rumor: NostrRumor) -> Result<Self, SoftchatError>
pub fn from_rumor(rumor: NostrRumor) -> Result<Self, SoftchatError>
Validate a kind-14 rumor as one non-empty text message to one peer.
One canonical p tag is required. Its optional relay-hint and extension
fields, plus all non-p tags, remain exact on the underlying rumor.
§Errors
Returns SoftchatError::InvalidNip17Message for an unsupported kind,
empty text, malformed or duplicate recipient, or self-recipient.
Sourcepub const fn id(&self) -> NostrEventId
pub const fn id(&self) -> NostrEventId
Return the canonical rumor ID used for conversation references.
Sourcepub fn sender(&self) -> NostrPublicKey
pub fn sender(&self) -> NostrPublicKey
Return the rumor’s declared author.
The author is authenticated only when the rumor came from a validated NIP-59 envelope.
Sourcepub fn recipient(&self) -> &NostrPublicKey
pub fn recipient(&self) -> &NostrPublicKey
Return the one peer named by the canonical recipient tag.
Sourcepub const fn created_at(&self) -> u64
pub const fn created_at(&self) -> u64
Return the canonical application timestamp.
Sourcepub const fn rumor(&self) -> &NostrRumor
pub const fn rumor(&self) -> &NostrRumor
Borrow the complete exact rumor, including unknown tags.
Sourcepub fn into_rumor(self) -> NostrRumor
pub fn into_rumor(self) -> NostrRumor
Consume the typed view without changing the underlying rumor.
Trait Implementations§
Source§impl Clone for Nip17TextMessage
impl Clone for Nip17TextMessage
Source§fn clone(&self) -> Nip17TextMessage
fn clone(&self) -> Nip17TextMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Nip17TextMessage
impl Debug for Nip17TextMessage
Source§impl PartialEq for Nip17TextMessage
impl PartialEq for Nip17TextMessage
Source§fn eq(&self, other: &Nip17TextMessage) -> bool
fn eq(&self, other: &Nip17TextMessage) -> bool
self and other values to be equal, and is used by ==.impl Eq for Nip17TextMessage
impl StructuralPartialEq for Nip17TextMessage
Auto Trait Implementations§
impl !Freeze for Nip17TextMessage
impl RefUnwindSafe for Nip17TextMessage
impl Send for Nip17TextMessage
impl Sync for Nip17TextMessage
impl Unpin for Nip17TextMessage
impl UnsafeUnpin for Nip17TextMessage
impl UnwindSafe for Nip17TextMessage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more