pub fn json<S, P>(event_type: S, payload: P) -> serde_json::Result<EventData>
    where
        P: Serialize,
        S: AsRef<str>,
    {
        let payload = Bytes::from(serde_json::to_vec(&payload)?);
        let mut metadata = HashMap::new();
        metadata.insert("type".to_owned(), event_type.as_ref().to_owned());
        metadata.insert("content-type".to_owned(), "application/json".to_owned());

        Ok(EventData {
            payload,
            id_opt: None,
            metadata,
            custom_metadata: None,
        })
    }
/// Creates an event with a JSON payload.
Creates an event with a JSON payload.
Creates an event with a JSON payload .
pub fn json<S, P>(event_type: S, payload: P) -> serde_json::Result<EventData>
    where
        P: Serialize,
        S: AsRef<str>,
    {
        let payload = Bytes::from(serde_json::to_vec(&payload)?);
        let mut metadata = HashMap::new();
        metadata.insert("type".to_owned(), event_type.as_ref().to_owned());
        metadata.insert("content-type".to_owned(), "application/json".to_owned());
        Ok(EventData {
            payload,
            id_opt: None,
            metadata,
            custom_metadata: None,
        })
    }
pub fn json < S , P > ( event_type : S , payload : P ) -> serde_json :: Result < EventData > where P : Serialize , S : AsRef < str > , { let payload = Bytes :: from ( serde_json :: to_vec ( & payload ) ? ) ; let mut metadata = HashMap :: new ( ) ; metadata . insert ( " " . to_owned ( ) , event_type . as_ref ( ) . to_owned ( ) ) ; metadata . insert ( " " . to_owned ( ) , " " . to_owned ( ) ) ; Ok ( EventData { payload , id_opt : None , metadata , custom_metadata : None , } ) }
Creates an event with a JSON payload.
Creates an event with a JSON payload .
event_type
S
payload
P
event_type
S
payload
P