pub struct CloudEventBuilder { /* private fields */ }
Expand description
Builder for CloudEvent
.
Implementations§
Source§impl CloudEventBuilder
impl CloudEventBuilder
Sourcepub fn source<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn source<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
Identifies the context in which an event happened. Often this will include information such as the type of the event source, the organization publishing the event or the process that produced the event. The exact syntax and semantics behind the data encoded in the URI is defined by the event producer.
Sourcepub fn spec_version<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn spec_version<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The version of the cloud events specification which the event uses. This enables the interpretation of the context. Compliant event producers MUST use a value of 1.0 when referring to this version of the specification.
Sourcepub fn event_type<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn event_type<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
Contains a value describing the type of event related to the originating occurrence. Often this attribute is used for routing, observability, policy enforcement, etc. The format of this is producer defined and might include information such as the version of the type.
Sourcepub fn data_schema<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn data_schema<VALUE: Into<Option<String>>>( &mut self, value: VALUE, ) -> &mut Self
Identifies the schema that data adheres to. Incompatible changes to the schema SHOULD be reflected by a different URI.
Sourcepub fn id<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn id<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
Identifies the event. Producers MUST ensure that source + id is unique for each distinct event. If a duplicate event is re-sent (e.g. due to a network error) it MAY have the same id. Consumers MAY assume that Events with identical source and id are duplicates.
Sourcepub fn time<VALUE: Into<Option<DateTime<Utc>>>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn time<VALUE: Into<Option<DateTime<Utc>>>>( &mut self, value: VALUE, ) -> &mut Self
Timestamp of when the occurrence happened. If the time of the occurrence cannot be determined then this attribute MAY be set to some other time (such as the current time) by the cloud event producer, however all producers for the same source MUST be consistent in this respect. In other words, either they all use the actual time of the occurrence or they all use the same algorithm to determine the value used.
Sourcepub fn subject<VALUE: Into<CloudEventSubject>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn subject<VALUE: Into<CloudEventSubject>>( &mut self, value: VALUE, ) -> &mut Self
Identifies the subject of the event in the context of the event producer (identified by source). In publish-subscribe scenarios, a subscriber will typically subscribe to events emitted by a source, but the source identifier alone might not be sufficient as a qualifier for any specific event if the source context has internal sub-structure.
Sourcepub fn build(&self) -> Result<CloudEvent, CloudEventBuilderError>
pub fn build(&self) -> Result<CloudEvent, CloudEventBuilderError>
Trait Implementations§
Source§impl Clone for CloudEventBuilder
impl Clone for CloudEventBuilder
Source§fn clone(&self) -> CloudEventBuilder
fn clone(&self) -> CloudEventBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more