pub struct Event<P = Payload> { /* private fields */ }Implementations§
Source§impl<P> Event<P>
impl<P> Event<P>
pub fn new( id: EventId, organization: OrganizationId, namespace: Namespace, topic: Topic, key: EventKey, payload: P, metadata: Metadata, timestamp: DateTime<Utc>, version: u64, parent_id: Option<EventId>, correlation_id: Option<EventKey>, causation_id: Option<EventKey>, ) -> Result<Self>
pub fn builder( organization: impl Into<String>, namespace: impl Into<String>, topic: impl Into<String>, key: impl Into<String>, payload: P, ) -> Result<EventBuilder<P>>
pub fn create( organization: impl Into<String>, namespace: impl Into<String>, topic: impl Into<String>, key: impl Into<String>, payload: P, ) -> Result<Self>
pub fn with_metadata(self, metadata: Metadata) -> Self
pub fn id(&self) -> EventId
pub fn organization(&self) -> &OrganizationId
pub fn namespace(&self) -> &Namespace
pub fn topic(&self) -> &Topic
pub fn payload(&self) -> &P
pub fn into_payload(self) -> P
pub fn metadata(&self) -> &Metadata
pub fn timestamp(&self) -> DateTime<Utc>
pub fn version(&self) -> u64
pub fn key(&self) -> &EventKey
pub fn parent_id(&self) -> Option<EventId>
pub fn correlation_id(&self) -> Option<&EventKey>
pub fn causation_id(&self) -> Option<&EventKey>
pub fn map_payload<Q, F>(self, f: F) -> Event<Q>where
F: FnOnce(P) -> Q,
pub fn try_map_payload<Q, F>(self, f: F) -> Result<Event<Q>>
pub fn encode_payload<C>(&self, codec: &C) -> Result<Event<Payload>>where
C: PayloadCodec<P>,
Source§impl Event<Payload>
impl Event<Payload>
pub fn decode_payload<P, C>(self, codec: &C) -> Result<Event<P>>where
C: PayloadCodec<P>,
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for Event<P>where
P: Freeze,
impl<P> RefUnwindSafe for Event<P>where
P: RefUnwindSafe,
impl<P> Send for Event<P>where
P: Send,
impl<P> Sync for Event<P>where
P: Sync,
impl<P> Unpin for Event<P>where
P: Unpin,
impl<P> UnsafeUnpin for Event<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for Event<P>where
P: UnwindSafe,
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more