pub struct PublicMessage {
pub content: String,
pub recipients: Vec<PublicMessageRecipient>,
pub extra_tags: Vec<Tag>,
}Expand description
Typed bundle for a kind: 24 public-message event.
Fields§
§content: StringPlaintext body.
recipients: Vec<PublicMessageRecipient>At least one recipient (per spec).
Forward-compatible passthrough for unknown tags.
Implementations§
Source§impl PublicMessage
impl PublicMessage
Sourcepub fn new(
content: impl Into<String>,
recipients: Vec<PublicMessageRecipient>,
) -> Self
pub fn new( content: impl Into<String>, recipients: Vec<PublicMessageRecipient>, ) -> Self
Construct a public message addressed to the given recipients.
Sourcepub fn from_event(event: &Event) -> Result<Self, PublicMessageError>
pub fn from_event(event: &Event) -> Result<Self, PublicMessageError>
Parse a kind: 24 public-message event.
§Errors
See PublicMessageError for the failure modes. Notably an
e tag triggers PublicMessageError::ForbiddenEventTag per
spec §“Warnings”.
Trait Implementations§
Source§impl Clone for PublicMessage
impl Clone for PublicMessage
Source§fn clone(&self) -> PublicMessage
fn clone(&self) -> PublicMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PublicMessage
impl Debug for PublicMessage
impl Eq for PublicMessage
Source§impl PartialEq for PublicMessage
impl PartialEq for PublicMessage
impl StructuralPartialEq for PublicMessage
Auto Trait Implementations§
impl Freeze for PublicMessage
impl RefUnwindSafe for PublicMessage
impl Send for PublicMessage
impl Sync for PublicMessage
impl Unpin for PublicMessage
impl UnsafeUnpin for PublicMessage
impl UnwindSafe for PublicMessage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.