pub struct CloudEventBuilder { /* private fields */ }
Expand description
Builder for CloudEvent
.
Implementations§
Source§impl CloudEventBuilder
impl CloudEventBuilder
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 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 subject<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn subject<VALUE: Into<Option<String>>>( &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 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 data_content_type<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn data_content_type<VALUE: Into<Option<String>>>( &mut self, value: VALUE, ) -> &mut Self
Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
Sourcepub fn builder_time<VALUE: Into<Option<String>>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn builder_time<VALUE: Into<Option<String>>>( &mut self, value: VALUE, ) -> &mut Self
time as a string so that it can be validated during build
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