[][src]Struct cloudevents::v02::CloudEventBuilder

pub struct CloudEventBuilder { /* fields omitted */ }

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

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.