[−][src]Struct cloudevents::v02::CloudEventBuilder
Create a new CloudEvent
.
Example
use cloudevents::v02::CloudEvent; use std::error::Error;
let event : Result<CloudEvent, Error> = CloudEventBuilder::default() .event_id("id") .source("http://www.google.com") .event_type("test type") .contenttype(Some("application/json") .build();
Methods
impl CloudEventBuilder
[src]
pub fn event_type<S: Into<String>>(self, s: S) -> Self
[src]
Set the event type.
pub fn source<S: Into<String>>(self, s: S) -> Self
[src]
Set the source.
pub fn event_id<S: Into<String>>(self, s: S) -> Self
[src]
Set the event id.
pub fn time<S: Into<String>>(self, s: S) -> Self
[src]
Set the time.
pub fn schemaurl<S: Into<String>>(self, s: S) -> Self
[src]
Set the schemaurl.
pub fn contenttype<S: Into<String>>(self, s: S) -> Self
[src]
Set the content type.
pub fn data(self, d: Data) -> Self
[src]
Set the data.
pub fn extensions(self, e: HashMap<String, ExtensionValue>) -> Self
[src]
Set the extensions.
pub fn build(self) -> Result<CloudEvent, Error>
[src]
Build a CloudEvent
.
Errors
An error is thrown if one of the required fields (event_type, id or source) is not populated, or if one of the validated fields (time, source and schemeurl) are populated with an invalid value.
Trait Implementations
impl Default for CloudEventBuilder
[src]
impl Debug for CloudEventBuilder
[src]
Auto Trait Implementations
impl Send for CloudEventBuilder
impl Sync for CloudEventBuilder
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,