[][src]Trait cloudevents::EventBuilder

pub trait EventBuilder where
    Self: Clone + Sized + From<Event> + Default
{ pub fn new() -> Self;
pub fn build(self) -> Result<Event, Error>; }

Trait to implement a builder for Event:

use cloudevents::event::{EventBuilderV10, EventBuilder};
use chrono::Utc;
use url::Url;

let event = EventBuilderV10::new()
    .id("my_event.my_application")
    .source("http://localhost:8080")
    .ty("example.demo")
    .time(Utc::now())
    .build()
    .unwrap();

You can create an EventBuilder starting from an existing Event using the From trait. You can create a default EventBuilder setting default values for some attributes.

Required methods

pub fn new() -> Self[src]

Create a new empty builder

pub fn build(self) -> Result<Event, Error>[src]

Build Event

Loading content...

Implementors

impl EventBuilder for cloudevents::event::EventBuilderV03[src]

impl EventBuilder for cloudevents::event::EventBuilderV10[src]

Loading content...