Skip to main content

Event

Struct Event 

Source
pub struct Event<P = Payload> { /* private fields */ }

Implementations§

Source§

impl<P> Event<P>

Source

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>

Source

pub fn builder( organization: impl Into<String>, namespace: impl Into<String>, topic: impl Into<String>, key: impl Into<String>, payload: P, ) -> Result<EventBuilder<P>>

Source

pub fn create( organization: impl Into<String>, namespace: impl Into<String>, topic: impl Into<String>, key: impl Into<String>, payload: P, ) -> Result<Self>

Source

pub fn with_metadata(self, metadata: Metadata) -> Self

Source

pub fn id(&self) -> EventId

Source

pub fn organization(&self) -> &OrganizationId

Source

pub fn namespace(&self) -> &Namespace

Source

pub fn topic(&self) -> &Topic

Source

pub fn payload(&self) -> &P

Source

pub fn into_payload(self) -> P

Source

pub fn metadata(&self) -> &Metadata

Source

pub fn timestamp(&self) -> DateTime<Utc>

Source

pub fn version(&self) -> u64

Source

pub fn key(&self) -> &EventKey

Source

pub fn parent_id(&self) -> Option<EventId>

Source

pub fn correlation_id(&self) -> Option<&EventKey>

Source

pub fn causation_id(&self) -> Option<&EventKey>

Source

pub fn map_payload<Q, F>(self, f: F) -> Event<Q>
where F: FnOnce(P) -> Q,

Source

pub fn try_map_payload<Q, F>(self, f: F) -> Result<Event<Q>>
where F: FnOnce(P) -> Result<Q>,

Source

pub fn encode_payload<C>(&self, codec: &C) -> Result<Event<Payload>>
where C: PayloadCodec<P>,

Source§

impl Event<Payload>

Source

pub fn decode_payload<P, C>(self, codec: &C) -> Result<Event<P>>
where C: PayloadCodec<P>,

Trait Implementations§

Source§

impl<P: Clone> Clone for Event<P>

Source§

fn clone(&self) -> Event<P>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Debug> Debug for Event<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more