pub enum RelayMessage {
Event {
sub_id: String,
event: NostrEvent,
},
Ok {
event_id: String,
accepted: bool,
message: String,
},
Eose(String),
Closed {
sub_id: String,
message: String,
},
Notice(String),
Unknown(String),
}Expand description
A relay→client message.
Variants§
Event
A stored/live event matching subscription sub_id.
Ok
Result of a publish: accepted + a human message.
Eose(String)
End of stored events for sub_id (live events follow).
Closed
The relay closed subscription sub_id with a reason.
Notice(String)
A human-readable relay notice.
Unknown(String)
A message type this client doesn’t model (forward-compat — never an error so a relay extension can’t wedge the read loop).
Implementations§
Source§impl RelayMessage
impl RelayMessage
Sourcepub fn parse(s: &str) -> Result<RelayMessage, RelayParseError>
pub fn parse(s: &str) -> Result<RelayMessage, RelayParseError>
Parse a relay→client message string. Unknown type tags are returned as
RelayMessage::Unknown rather than erroring.
Trait Implementations§
Source§impl Clone for RelayMessage
impl Clone for RelayMessage
Source§fn clone(&self) -> RelayMessage
fn clone(&self) -> RelayMessage
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 RelayMessage
impl Debug for RelayMessage
Source§impl PartialEq for RelayMessage
impl PartialEq for RelayMessage
impl StructuralPartialEq for RelayMessage
Auto Trait Implementations§
impl Freeze for RelayMessage
impl RefUnwindSafe for RelayMessage
impl Send for RelayMessage
impl Sync for RelayMessage
impl Unpin for RelayMessage
impl UnsafeUnpin for RelayMessage
impl UnwindSafe for RelayMessage
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