pub struct StreamEvent {
pub event: String,
pub id: Option<String>,
pub cursor: Option<String>,
pub data: String,
}Expand description
One event of the stream: the same envelope a webhook carries.
Fields§
§event: StringThe frame’s event: field: the event type (message.received).
id: Option<String>The envelope’s id (evt_...), stable across replays.
cursor: Option<String>The cursor after this event: resume from it with last_event_id.
data: StringThe frame’s data:, exactly as received: the envelope as JSON.
Implementations§
Source§impl StreamEvent
impl StreamEvent
Sourcepub fn parse(&self) -> Result<WebhookEvent, Error>
pub fn parse(&self) -> Result<WebhookEvent, Error>
The event, typed. An event of a type this version of the crate does
not know still parses (as the union’s Unknown).
§Errors
The JSON error, when the envelope does not match the type. The
stream is not affected: StreamEvent::data still has the text.
Trait Implementations§
Source§impl Clone for StreamEvent
impl Clone for StreamEvent
Source§impl Debug for StreamEvent
impl Debug for StreamEvent
impl Eq for StreamEvent
Source§impl PartialEq for StreamEvent
impl PartialEq for StreamEvent
impl StructuralPartialEq for StreamEvent
Auto Trait Implementations§
impl Freeze for StreamEvent
impl RefUnwindSafe for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin for StreamEvent
impl UnsafeUnpin for StreamEvent
impl UnwindSafe for StreamEvent
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
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.